/* ═══════════════════════════════════════════════════
   Call Logger — Redesigned dark-native UI
   Two-column unified card with accent client banner
   ═══════════════════════════════════════════════════ */

/* ── Container ── */

.cl-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

/* ── Status Bar ── */

.cl-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    margin-bottom: 12px;
}

.cl-status-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.cl-status-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cl-status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-tertiary, #636366);
    transition: background 0.3s ease;
}

.cl-status-indicator.cl-status-loading {
    background: var(--apple-blue);
    animation: cl-dot-pulse 1.2s ease-in-out infinite;
}

.cl-status-indicator.cl-status-ready {
    background: var(--success, #30d158);
}

.cl-status-indicator.cl-status-error {
    background: var(--danger, #ff453a);
}

@keyframes cl-dot-pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50%       { opacity: 1;   transform: scale(1.2); }
}

.cl-status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Status Bar Buttons ── */

.cl-refresh-btn,
.cl-new-log-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-family: inherit;
}

.cl-refresh-btn {
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.cl-refresh-btn:hover {
    color: var(--text);
    border-color: var(--text-tertiary, #636366);
}

.cl-new-log-btn {
    color: var(--apple-blue);
    background: rgba(0, 122, 255, 0.08);
    border: 1px solid rgba(0, 122, 255, 0.2);
}

.cl-new-log-btn:hover {
    background: rgba(0, 122, 255, 0.14);
    border-color: rgba(0, 122, 255, 0.35);
}

.cl-refresh-btn:active,
.cl-new-log-btn:active {
    transform: scale(0.96);
}

.cl-refresh-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.cl-refresh-btn.cl-refreshing svg {
    animation: cl-spin 0.8s linear infinite;
}

@keyframes cl-spin {
    to { transform: rotate(360deg); }
}

/* ── Main Card ── */

.cl-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

/* ── Initials Inline (in status bar) ── */

.cl-initials-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.cl-initials-as {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.cl-input-initials {
    width: 42px;
    padding: 1px 2px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--border);
    border-radius: 0;
    outline: none;
    transition: border-color 0.2s, color 0.2s;
}

.cl-input-initials:focus-visible {
    border-bottom-color: var(--apple-blue);
    color: var(--text);
}

/* ── Desktop Two-Column Grid ── */

.cl-desktop-grid {
    display: grid;
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .cl-desktop-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.cl-col-form {
    border-right: 1px solid var(--border);
}

/* When right column is hidden, let form fill width */
@media (min-width: 900px) {
    .cl-desktop-grid:has(> .cl-col-output > *[style*="display: none"]:only-child),
    .cl-desktop-grid:has(> .cl-col-output:empty) {
        grid-template-columns: 1fr;
    }

    .cl-desktop-grid:has(> .cl-col-output > *[style*="display: none"]:only-child) .cl-col-form,
    .cl-desktop-grid:has(> .cl-col-output:empty) .cl-col-form {
        border-right: none;
    }
}

/* ── Form Sections ── */

.cl-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.cl-section-notes {
    border-bottom: none;
}

.cl-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 12px;
    padding-left: 8px;
    border-left: 3px solid var(--apple-blue);
}

/* ── Base Input ── */

.cl-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.cl-input:focus-visible {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

/* ── Search Input ── */

.cl-search-wrapper {
    position: relative;
}

.cl-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
}

.cl-input-search {
    padding-left: 38px;
}

/* ── Client Dropdown ── */

.cl-client-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.cl-client-row {
    padding: 9px 14px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.cl-client-row:last-child {
    border-bottom: none;
}

.cl-client-row:hover {
    background: rgba(0, 122, 255, 0.07);
}

.cl-client-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--apple-blue);
    background: rgba(0, 122, 255, 0.1);
    border-radius: 6px;
    padding: 2px 7px;
    flex-shrink: 0;
}

.cl-client-badge-none {
    color: var(--text-secondary);
    background: var(--bg-input);
}

.cl-client-number {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.cl-client-aka {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ── Client Banner (selected state) ── */

.cl-client-banner {
    background: rgba(0, 122, 255, 0.07);
    border: 1px solid rgba(0, 122, 255, 0.18);
    border-radius: 10px;
    padding: 12px 14px;
    animation: cl-banner-in 0.2s ease both;
}

@keyframes cl-banner-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cl-banner-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.cl-banner-info { flex: 1; min-width: 0; }

.cl-banner-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cl-banner-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
}

.cl-banner-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}

/* HawkSoft link inside banner */
.cl-view-in-hawksoft {
    line-height: 1;
}

.cl-view-hs-link,
.cl-client-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--apple-blue);
    text-decoration: none;
    transition: opacity 0.15s;
}

.cl-view-hs-link:hover,
.cl-client-link:hover {
    opacity: 0.75;
}

/* "← change" button */
.cl-change-client-btn {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s;
}

.cl-change-client-btn:hover {
    color: var(--text);
}

/* ── Policy Selector (inside banner) ── */

.cl-policy-select {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 122, 255, 0.12);
}

.cl-policy-select-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 7px;
}

.cl-policy-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cl-policy-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.cl-policy-chip:hover {
    border-color: var(--apple-blue);
    color: var(--text);
}

.cl-policy-chip.cl-policy-selected {
    background: rgba(0, 122, 255, 0.12);
    border-color: rgba(0, 122, 255, 0.4);
    color: var(--apple-blue);
    font-weight: 600;
}

.cl-policy-icon { font-size: 13px; line-height: 1; }

.cl-policy-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cl-policy-type {
    font-size: 12px;
    font-weight: 600;
}

.cl-policy-num {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.cl-policy-exp {
    font-size: 10px;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* ── Channel Buttons ── */

.cl-channel-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cl-channel-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1;
}

.cl-channel-btn svg {
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.cl-channel-btn:hover {
    border-color: var(--apple-blue);
    color: var(--text);
}

.cl-channel-btn:hover svg { opacity: 1; }

.cl-channel-btn:active { transform: scale(0.96); }

.cl-channel-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.cl-channel-btn.cl-channel-selected {
    color: var(--apple-blue);
    background: rgba(0, 122, 255, 0.1);
    border-color: rgba(0, 122, 255, 0.35);
}

.cl-channel-btn.cl-channel-selected svg {
    opacity: 1;
    color: var(--apple-blue);
}

/* ── Activity Dropdown ── */

.cl-activity-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636366' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
    cursor: pointer;
}

.cl-activity-select option {
    background: var(--bg-card);
    color: var(--text);
}

/* ── Textarea ── */

.cl-textarea {
    width: 100%;
    min-height: 110px;
    padding: 12px 14px;
    font-size: 14px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.cl-textarea:focus-visible {
    border-color: var(--apple-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.cl-textarea::placeholder {
    color: var(--text-secondary);
    font-family: inherit;
    font-style: italic;
}

/* ── Submit Button ── */

.cl-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--apple-blue);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    font-family: inherit;
}

.cl-submit-btn:hover:not(:disabled) {
    opacity: 0.88;
}

.cl-submit-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.cl-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.cl-submit-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

.cl-btn-text { display: inline; }
.cl-btn-arrow { display: inline; transition: transform 0.2s; flex-shrink: 0; }
.cl-submit-btn:hover:not(:disabled) .cl-btn-arrow { transform: translateX(2px); }

.cl-btn-spinner {
    display: none;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cl-spin 0.6s linear infinite;
}

.cl-submit-btn.cl-loading .cl-btn-text,
.cl-submit-btn.cl-loading .cl-btn-arrow { display: none; }
.cl-submit-btn.cl-loading .cl-btn-spinner { display: inline-block; }

/* Re-format / edit mode */
.cl-submit-btn.cl-edit-mode {
    background: transparent;
    color: var(--apple-blue);
    border: 1px solid rgba(0, 122, 255, 0.35);
}

.cl-submit-btn.cl-edit-mode:hover:not(:disabled) {
    background: rgba(0, 122, 255, 0.08);
    opacity: 1;
}

/* ── Right Column ── */

.cl-col-output {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 900px) {
    .cl-col-output {
        position: sticky;
        top: 24px;
        align-self: start;
    }
}

/* ── Preview Card ── */

.cl-preview {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-left: 3px solid var(--apple-blue);
    border-radius: 10px;
    overflow: hidden;
    animation: cl-card-in 0.3s ease both;
}

@keyframes cl-card-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cl-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.cl-preview-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.cl-preview-text {
    padding: 14px;
    margin: 0;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    line-height: 1.65;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 380px;
    overflow-y: auto;
}

/* ── Inline Edit Textarea ── */

.cl-edit-textarea {
    display: block;
    width: 100%;
    min-height: 200px;
    max-height: 380px;
    padding: 14px;
    margin: 0;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg-input);
    border: none;
    border-top: 2px solid var(--apple-blue);
    border-radius: 0 0 9px 9px;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
}

/* ── Copy Button ── */

.cl-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--apple-blue);
    background: rgba(0, 122, 255, 0.08);
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
}

.cl-copy-btn:hover {
    background: var(--apple-blue);
    color: #fff;
}

.cl-copy-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* ── Confirmation Section ── */

.cl-confirm-section {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    animation: cl-card-in 0.3s ease both;
}

.cl-confirm-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: -0.1px;
}

.cl-confirm-info {
    font-size: 13px;
    color: var(--text);
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 12px;
    line-height: 1.5;
    border: 1px solid var(--border);
}

.cl-confirm-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cl-confirm-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text);
}

.cl-confirm-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 64px;
    flex-shrink: 0;
}

.cl-confirm-policy {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(0, 122, 255, 0.08);
    color: var(--apple-blue);
    vertical-align: middle;
}

.cl-confirm-notice {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 10px 0 14px;
    line-height: 1.4;
}

.cl-confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cl-confirm-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: var(--success, #30d158);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s, transform 0.15s;
}

.cl-confirm-btn:hover:not(:disabled) { opacity: 0.88; }
.cl-confirm-btn:active:not(:disabled) { transform: scale(0.98); }
.cl-confirm-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.cl-cancel-btn {
    width: 100%;
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}

.cl-cancel-btn:hover {
    color: var(--text);
    border-color: var(--text-secondary);
}

/* ── HawkSoft client link in confirm section ── */

.cl-client-link {
    color: var(--apple-blue);
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
}

.cl-client-link:hover { opacity: 0.75; }

.cl-client-link:focus-visible {
    outline: 2px solid var(--apple-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Dark mode overrides ── */

body.dark-mode .cl-client-dropdown {
    background: #1C1C1E;
    border-color: #38383A;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

body.dark-mode .cl-policy-chip {
    background: #2C2C2E;
    border-color: #38383A;
}

body.dark-mode .cl-client-link {
    color: var(--apple-blue);
}

body.dark-mode .cl-confirm-policy {
    background: rgba(10, 132, 255, 0.15);
    color: var(--apple-blue);
}
