/* ============================================================
   ACTBrief — AI Document Summariser with Narration & Modifiers
   Professional executive briefing tool for pension scheme documents
   (c) 2026 Advanced Client Targeting Ltd
   ============================================================ */

/* ---- Modal Overlay ---- */
.actbrief-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.88);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: actbrief-fadein 0.3s ease;
}
.actbrief-overlay.active { display: flex; }

@keyframes actbrief-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---- Main Container ---- */
.actbrief-container {
    width: 94vw;
    max-width: 1060px;
    max-height: 96vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0,0,0,0.5);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ---- Header ---- */
.actbrief-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #0D2137;
    color: #4FC3F7;
    border-bottom: 2px solid #4FC3F7;
}
.actbrief-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.actbrief-header-logo {
    width: 36px; height: 36px;
    border-radius: 8px;
}
.actbrief-header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}
.actbrief-header-subtitle {
    font-size: 11px;
    color: #8899AA;
    margin-top: -2px;
}
.actbrief-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.actbrief-close {
    background: none;
    border: 2px solid #4FC3F7;
    color: #4FC3F7;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.actbrief-close:hover {
    background: #4FC3F7;
    color: #0D2137;
}

/* ---- BlitzRead button inside ACTBrief ---- */
.actbrief-blitzread-btn {
    background: #0D1B2A;
    border: 2px solid #FFB300;
    color: #FFB300;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    white-space: nowrap;
}
.actbrief-blitzread-btn:hover {
    background: #FFB300;
    color: #0D1B2A;
}
.actbrief-blitzread-btn img {
    width: 16px; height: 16px;
    border-radius: 3px;
}

/* ---- Status Bar ---- */
.actbrief-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
    background: #0A1929;
    border-bottom: 1px solid #1E3A5F;
    font-size: 12px;
    color: #8899AA;
}
.actbrief-status-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.actbrief-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.actbrief-status-badge.generating {
    background: rgba(255,179,0,0.15);
    color: #FFB300;
}
.actbrief-status-badge.ready {
    background: rgba(76,175,80,0.15);
    color: #4CAF50;
}
.actbrief-status-badge.error {
    background: rgba(230,57,70,0.15);
    color: #E63946;
}
.actbrief-status-badge .spinner {
    width: 12px; height: 12px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: actbrief-spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes actbrief-spin {
    to { transform: rotate(360deg); }
}

/* ================================================================
   MODIFIER PANEL
   ================================================================ */
.actbrief-modifiers {
    background: #0F1D2F;
    border-bottom: 1px solid #1E3A5F;
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
}
.actbrief-modifiers.open {
    max-height: 500px;
    padding: 10px 16px;
}
.actbrief-modifiers-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
    background: #0D2137;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #1E3A5F;
    transition: background 0.2s;
}
.actbrief-modifiers-toggle:hover {
    background: #122A42;
}
.actbrief-modifiers-toggle-label {
    color: #4FC3F7;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.actbrief-modifiers-toggle-arrow {
    color: #4FC3F7;
    font-size: 14px;
    transition: transform 0.3s;
}
.actbrief-modifiers-toggle.open .actbrief-modifiers-toggle-arrow {
    transform: rotate(180deg);
}
.actbrief-modifiers-toggle .actbrief-active-count {
    background: #4FC3F7;
    color: #0D2137;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 6px;
}

/* Modifier row */
.actbrief-mod-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.actbrief-mod-label {
    color: #4FC3F7;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    min-width: 80px;
    white-space: nowrap;
}

/* Chip-style modifier buttons */
.actbrief-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 11px;
    border-radius: 14px;
    border: 1px solid #2A4060;
    background: #152238;
    color: #8899AA;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}
.actbrief-chip:hover {
    border-color: #4FC3F7;
    color: #CBD5E1;
    background: #1A2D48;
}
.actbrief-chip.active {
    border-color: #4FC3F7;
    background: rgba(79,195,247,0.18);
    color: #4FC3F7;
    font-weight: 600;
}
.actbrief-chip.active-accent {
    border-color: #FFB300;
    background: rgba(255,179,0,0.15);
    color: #FFB300;
    font-weight: 600;
}
.actbrief-chip .chip-icon {
    font-size: 12px;
}

/* Re-summarise button */
.actbrief-resummarise-btn {
    background: linear-gradient(135deg, #4FC3F7, #0288D1);
    color: #fff;
    border: none;
    padding: 7px 18px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(79,195,247,0.3);
    margin-left: auto;
}
.actbrief-resummarise-btn:hover {
    background: linear-gradient(135deg, #81D4FA, #0299E1);
    box-shadow: 0 4px 16px rgba(79,195,247,0.4);
    transform: translateY(-1px);
}
.actbrief-resummarise-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.actbrief-resummarise-btn .spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: actbrief-spin 0.8s linear infinite;
    display: none;
}
.actbrief-resummarise-btn.loading .spinner {
    display: inline-block;
}

/* ---- Content Area ---- */
.actbrief-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: #FAFBFC;
    color: #1a1a2e;
    line-height: 1.7;
    font-size: 14.5px;
    min-height: 200px;
    max-height: 50vh;
}
.actbrief-content h1 {
    font-size: 20px;
    font-weight: 700;
    color: #0D2137;
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #4FC3F7;
}
.actbrief-content h2 {
    font-size: 16px;
    font-weight: 700;
    color: #0D2137;
    margin: 18px 0 8px 0;
    padding-left: 12px;
    border-left: 3px solid #4FC3F7;
}
.actbrief-content h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1E3A5F;
    margin: 14px 0 6px 0;
}
.actbrief-content p {
    margin: 0 0 10px 0;
}
.actbrief-content ul, .actbrief-content ol {
    margin: 0 0 10px 0;
    padding-left: 22px;
}
.actbrief-content li {
    margin-bottom: 5px;
}
.actbrief-content strong {
    color: #0D2137;
}
.actbrief-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12.5px;
}
.actbrief-content table th {
    background: #0D2137;
    color: #4FC3F7;
    padding: 7px 10px;
    text-align: left;
    font-weight: 600;
}
.actbrief-content table td {
    padding: 7px 10px;
    border-bottom: 1px solid #E0E0E0;
}
.actbrief-content table tr:nth-child(even) td {
    background: #F0F4F8;
}
.actbrief-content blockquote {
    margin: 10px 0;
    padding: 10px 14px;
    background: #E8F0FE;
    border-left: 4px solid #4FC3F7;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #1E3A5F;
}

/* Loading state */
.actbrief-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: 16px;
}
.actbrief-loading-spinner {
    width: 44px; height: 44px;
    border: 4px solid #E0E0E0;
    border-top-color: #4FC3F7;
    border-radius: 50%;
    animation: actbrief-spin 0.8s linear infinite;
}
.actbrief-loading-text {
    color: #667788;
    font-size: 13px;
    text-align: center;
}
.actbrief-loading-progress {
    width: 200px;
    height: 4px;
    background: #E0E0E0;
    border-radius: 2px;
    overflow: hidden;
}
.actbrief-loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4FC3F7, #FFB300);
    border-radius: 2px;
    animation: actbrief-progress 2s ease-in-out infinite;
    width: 40%;
}
@keyframes actbrief-progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* Sentence highlight during narration */
.actbrief-highlight {
    background: rgba(79,195,247,0.15);
    border-radius: 3px;
    transition: background 0.2s;
}

/* ---- Narration Controls ---- */
.actbrief-narration {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #0D2137;
    border-top: 1px solid #1E3A5F;
    flex-wrap: wrap;
}
.actbrief-narration-label {
    color: #4FC3F7;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}
.actbrief-btn {
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}
.actbrief-btn-narrate {
    background: #4FC3F7;
    color: #0D2137;
}
.actbrief-btn-narrate:hover { background: #81D4FA; }
.actbrief-btn-narrate.active {
    background: #E63946;
    color: white;
}
.actbrief-btn-pause {
    background: #FFB300;
    color: #0D2137;
}
.actbrief-btn-pause:hover { background: #FFC107; }
.actbrief-btn-copy {
    background: #1E3A5F;
    color: #CBD5E1;
    border: 1px solid #2E4A6F;
}
.actbrief-btn-copy:hover {
    background: #2E4A6F;
    border-color: #4FC3F7;
}
.actbrief-btn-copy.copied {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

/* Voice selector */
.actbrief-voice-select {
    background: #1E293B;
    border: 1px solid #334155;
    color: #CBD5E1;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    outline: none;
    max-width: 150px;
}
.actbrief-voice-select:focus {
    border-color: #4FC3F7;
}

/* Rate/Pitch sliders */
.actbrief-voice-adjust {
    display: flex;
    align-items: center;
    gap: 4px;
}
.actbrief-voice-adjust label {
    color: #8899AA;
    font-size: 10px;
    min-width: 30px;
}
.actbrief-voice-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: #334155;
    outline: none;
}
.actbrief-voice-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #4FC3F7;
    cursor: pointer;
}
.actbrief-voice-slider::-moz-range-thumb {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #4FC3F7;
    cursor: pointer;
}

/* Narration progress */
.actbrief-narration-progress {
    flex: 1;
    min-width: 60px;
    height: 3px;
    background: #1E3A5F;
    border-radius: 2px;
    overflow: hidden;
}
.actbrief-narration-progress-fill {
    height: 100%;
    background: #4FC3F7;
    width: 0%;
    transition: width 0.3s;
}

/* ---- Trigger Button (sits on document viewer modals) ---- */
.actbrief-trigger {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 2px solid #4FC3F7;
    background: #0D2137;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1000;
}
.actbrief-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(79,195,247,0.4);
}
.actbrief-trigger img {
    width: 28px; height: 28px;
    border-radius: 6px;
}
.actbrief-trigger-tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #0D2137;
    color: #4FC3F7;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.actbrief-trigger:hover .actbrief-trigger-tooltip {
    opacity: 1;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .actbrief-container { width: 98vw; }
    .actbrief-content { padding: 14px; font-size: 13px; }
    .actbrief-narration { gap: 5px; }
    .actbrief-mod-label { min-width: 60px; font-size: 10px; }
    .actbrief-chip { font-size: 10px; padding: 3px 8px; }
}
