/* ============================================================
   CSS VARIABLES - Scholarly Parchment Design
   ============================================================ */
:root {
    /* Core palette */
    --primary: #1a3c34;
    --primary-dark: #0d211c;
    --accent: #c5a059;
    --accent-muted: rgba(197, 160, 89, 0.6);
    --parchment: #f4f1ea;
    --parchment-dark: #ebe6db;
    --ink-dark: #1a1a1a;
    --ink-light: #4a4a4a;
    --ink-muted: #8a8578;
    --white: #ffffff;
    --red: #9b2c2c;
    --green-muted: #2d6a4f;

    /* Functional tokens */
    --bg-primary: var(--parchment);
    --bg-secondary: var(--parchment-dark);
    --bg-card: var(--white);
    --border: rgba(26, 60, 52, 0.1);
    --border-accent: rgba(197, 160, 89, 0.3);
    --text-primary: var(--ink-light);
    --text-heading: var(--primary);
    --text-muted: var(--ink-muted);

    /* Shadows */
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radius */
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 6px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

/* ============================================================
   MATERIAL SYMBOLS
   ============================================================ */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Libre Baskerville', Georgia, serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
}

h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--text-heading);
}

/* ============================================================
   CUSTOM SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--ink-muted);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--ink-light);
}

/* ============================================================
   FOCUS-VISIBLE
   ============================================================ */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

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

/* ============================================================
   CONTAINER
   ============================================================ */
.container {
    max-width: 100%;
    margin: 0 auto;
    background: var(--bg-primary);
    overflow-x: hidden;
}

/* ============================================================
   HEADER - Dark green gradient with gold accent
   ============================================================ */
header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 14px var(--space-lg) 12px;
    text-align: center;
    position: relative;
    border-bottom: 3px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.new-chat-btn {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
}

.new-chat-btn .material-symbols-outlined {
    font-size: 18px;
    color: var(--white);
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.02);
}

.new-chat-btn:active {
    transform: translateY(-50%) scale(0.98);
}

.user-area {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--white);
    font-size: 13px;
}

.user-display-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.9;
}

.sign-out-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 3px 6px;
    transition: background 0.2s;
}

.sign-out-btn .material-symbols-outlined {
    font-size: 16px;
}

.sign-out-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.header-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-accent);
    margin-bottom: 8px;
}

.header-icon-badge .material-symbols-outlined {
    color: var(--accent);
    font-size: 22px;
}

header h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 900;
    color: var(--white);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 2px;
    line-height: 1.2;
}

.tagline {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 9px;
    font-weight: 700;
    font-style: italic;
    color: var(--accent-muted);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-bottom: 0;
}

.header-rule {
    display: none;
}

/* ============================================================
   TAB NAVIGATION - Icon + label column style
   ============================================================ */
.tabs {
    background: rgba(244, 241, 234, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: var(--space-md) var(--space-sm);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: var(--space-sm) var(--space-md);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn .tab-icon {
    font-size: 24px;
    transition: color var(--transition-fast);
}

.tab-btn .tab-label {
    font-size: 9px;
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active .tab-icon {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    display: block;
    width: 16px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
    margin-top: 4px;
}

/* ============================================================
   TAB CONTENT
   ============================================================ */
.content {
    padding: 0;
    min-height: 500px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
    min-height: calc(100vh - 280px);
}

.tab-content.active {
    display: block;
}

/* ============================================================
   CHAT INTERFACE
   ============================================================ */
.chat-study-layout {
    display: flex;
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.chat-study-layout .chat-container {
    flex: 1;
    min-width: 0;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 80vh;
    min-height: 600px;
    max-width: 840px;
    margin: 0 auto;
    padding: var(--space-lg);
}

/* ============================================================
   STUDY PANEL
   ============================================================ */

.study-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    height: 100vh;
    border-left: 1px solid var(--border);
    background: var(--bg-primary);
    z-index: 400;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 20px rgba(0,0,0,0.12);
}

.study-panel.study-panel-open {
    transform: translateX(0);
}

/* Study panel is fixed overlay — no layout shift needed */

.study-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--primary);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-shrink: 0;
}

.study-panel-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
}

.study-panel-close {
    background: none;
    border: none;
    color: var(--accent-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 0 var(--space-xs);
    line-height: 1;
    transition: color var(--transition-fast);
}

.study-panel-close:hover {
    color: var(--white);
}

.study-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    border: 1px solid var(--border);
    border-top: none;
}

/* Study panel verse cards */
.study-verse-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.study-verse-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border-top: 2px solid var(--border-accent);
    border-right: 2px solid var(--border-accent);
    border-radius: 0 var(--radius-md) 0 0;
    pointer-events: none;
}

.study-verse-ref {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.study-verse-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    font-style: italic;
    margin-bottom: var(--space-sm);
}

.study-verse-num {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    margin-right: var(--space-xs);
    font-style: normal;
    vertical-align: super;
}

.compare-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: var(--space-sm);
    background: var(--bg-primary);
    border: 1px dashed var(--border-accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.compare-btn:hover {
    background: var(--parchment-dark);
    border-style: solid;
}

.compare-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.study-section-label {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
}

.study-arabic-text {
    font-size: 22px;
    line-height: 2;
    direction: rtl;
    text-align: right;
    color: var(--ink-dark);
    margin-bottom: var(--space-sm);
    padding: var(--space-md);
    background: var(--parchment-dark);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.study-translation-card {
    padding: var(--space-sm) var(--space-md);
    border-left: 2px solid var(--accent);
    margin-bottom: var(--space-sm);
    background: rgba(197, 160, 89, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.study-translation-name {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-xs);
}

.study-translation-text {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-primary);
}

.qiraat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-md);
}

.qiraat-tab {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-muted);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.qiraat-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--accent-muted);
}

.qiraat-tab.active {
    background: var(--primary);
    color: var(--accent);
    border-color: var(--primary);
}

.study-loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.study-error {
    text-align: center;
    padding: var(--space-lg);
    color: var(--red);
    font-size: 14px;
}

/* ============================================================
   CHAT MESSAGES AREA
   ============================================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
}

/* Welcome Message - Document card style */
.welcome-message {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.5s ease;
}

.welcome-corner {
    position: absolute;
    top: 0;
    right: 0;
    width: 64px;
    height: 64px;
    border-top: 3px solid var(--border-accent);
    border-right: 3px solid var(--border-accent);
    border-radius: 0 var(--radius-md) 0 0;
    pointer-events: none;
}

.welcome-message h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0;
    padding-bottom: 0;
    text-align: center;
}

.welcome-message h2::after {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent), transparent);
    margin: var(--space-md) 0;
}

.welcome-intro {
    color: var(--ink-light);
    margin-bottom: var(--space-sm);
    font-size: 13px;
    font-style: italic;
    line-height: 1.6;
}

.welcome-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-md) 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: opacity 0.3s ease;
}

.welcome-list.welcome-list-fade {
    opacity: 0;
}

.welcome-list li {
    background: rgba(244, 241, 234, 0.3);
    border-left: 2px solid var(--accent);
    padding: 8px var(--space-md);
    font-size: 14px;
}

.welcome-list li span {
    color: var(--ink-dark);
    font-style: italic;
    line-height: 1.5;
}

/* Messages */
.message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    animation: slideIn 0.3s ease;
}

.message-wrapper.user {
    justify-content: flex-end;
}

.message-wrapper.assistant {
    justify-content: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}

.message-avatar.user-avatar {
    background: var(--primary);
    order: 2;
}

.message-avatar.ai-avatar {
    background: var(--accent);
    color: var(--primary-dark);
}

.message-bubble {
    max-width: 70%;
}

.message-role {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: var(--space-xs);
}

.message-role.user-role {
    text-align: right;
    color: rgba(26, 60, 52, 0.4);
}

.message-role.ai-role {
    color: var(--accent);
}

.message-content {
    padding: var(--space-md) var(--space-lg);
    font-size: 14px;
    line-height: 1.65;
}

.message-wrapper.user .message-content {
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-lg);
}

.message-wrapper.assistant .message-content {
    background: var(--white);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-sm);
    box-shadow: var(--shadow-card);
}

/* Markdown-rendered AI responses */
.message-content.markdown-body {
    white-space: normal;
}

.markdown-body h2 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--primary);
    font-size: 1.15em;
    margin: 20px 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.markdown-body h2:first-child {
    margin-top: 5px;
}

/* Section icons — replace emojis with Material Symbols */
.section-icon {
    font-size: 20px;
    vertical-align: middle;
    margin-right: 4px;
}

.icon-pin {
    color: var(--primary);
}

.icon-warn {
    color: var(--accent);
}

.icon-target {
    color: var(--primary);
}

.icon-check {
    color: var(--green-muted);
    font-size: 16px;
}

.icon-book {
    color: var(--accent);
    font-size: 16px;
}

.markdown-body h3 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--ink-dark);
    font-size: 1.05em;
    margin: 15px 0 8px 0;
}

.markdown-body p {
    margin: 8px 0;
}

.markdown-body ul, .markdown-body ol {
    margin: 8px 0;
    padding-left: 24px;
}

.markdown-body li {
    margin: 4px 0;
}

.markdown-body strong {
    color: var(--ink-dark);
}

.markdown-body blockquote {
    border-left: 2px solid var(--accent);
    padding: 8px 16px;
    margin: 10px 0;
    background: rgba(197, 160, 89, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--ink-light);
}

.markdown-body hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--accent), transparent);
    margin: 16px 0;
}

.markdown-body code {
    background: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.9em;
    color: var(--accent);
}

.markdown-body pre {
    background: var(--primary-dark);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 10px 0;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: var(--parchment);
}

/* Verse Links (clickable references in AI responses) */
.verse-link {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
    font-weight: 700;
    transition: color var(--transition-fast), background var(--transition-fast);
    border-radius: 3px;
    padding: 0 2px;
}

.verse-link:hover {
    color: var(--primary);
    text-decoration-style: solid;
}

/* Active verse — the one currently loaded in the study panel */
.verse-link.verse-link-active {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--primary);
    text-decoration-style: solid;
}

/* Chat Input */
.chat-input-container {
    background: var(--white);
    border: 1px solid var(--border);
    padding: var(--space-sm);
    display: flex;
    align-items: flex-end;
    gap: var(--space-sm);
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
}

.chat-input-container:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.input-icon {
    color: rgba(26, 60, 52, 0.3);
    padding: var(--space-sm);
    flex-shrink: 0;
}

#chatInput {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 14px;
    color: var(--ink-dark);
    padding: var(--space-sm);
    resize: none;
    min-height: 40px;
    line-height: 1.5;
}

#chatInput::placeholder {
    color: var(--ink-muted);
    font-style: italic;
}

#chatInput:focus {
    outline: none;
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: var(--accent);
    border: none;
    padding: var(--space-sm) var(--space-md);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: transparent;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--primary);
    color: var(--accent);
    border: none;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-sm);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--primary-dark);
}

.btn-secondary:active {
    transform: scale(0.97);
}

/* Loading Dots */
.loader {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.loader .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: dotBounce 1.4s infinite ease-in-out both;
}

.loader .dot:nth-child(1) { animation-delay: -0.32s; }
.loader .dot:nth-child(2) { animation-delay: -0.16s; }
.loader .dot:nth-child(3) { animation-delay: 0s; }

/* ============================================================
   SECTION CONTAINER (shared by Topics, Objections, Verses)
   ============================================================ */
.section-container {
    max-width: 840px;
    margin: 0 auto;
    padding: var(--space-lg);
}

.section-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

/* ============================================================
   TOPICS & OBJECTIONS CARDS - Document card style
   ============================================================ */
.topic-card, .objection-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
}

.topic-card:hover, .objection-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--border-accent);
}

.topic-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topic-card-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.topic-emoji {
    font-size: 24px;
}

.topic-title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-dark);
}

.topic-card h3 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-dark);
    margin-bottom: 0;
}

.topic-card p {
    color: var(--text-primary);
    font-size: 14px;
    margin: var(--space-sm) 0;
}

.objection-card h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-dark);
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

.objection-summary {
    color: var(--text-muted);
    margin: var(--space-sm) 0 var(--space-md) 0;
    font-style: italic;
    font-size: 14px;
}

/* Badges */
.badge {
    display: inline-block;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 2px;
    white-space: nowrap;
    margin-right: var(--space-xs);
    margin-top: var(--space-sm);
    letter-spacing: 0.02em;
}

.topic-category {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 10px;
    font-weight: 700;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 2px;
    background: rgba(26, 60, 52, 0.08);
    color: var(--primary);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-islam {
    background: rgba(180, 100, 40, 0.1);
    color: #9c5520;
}

.badge-atheism {
    background: rgba(100, 100, 140, 0.1);
    color: #5a5a80;
}

.badge-judaism {
    background: rgba(160, 130, 50, 0.1);
    color: #8a7030;
}

.badge-skepticism {
    background: rgba(120, 120, 120, 0.1);
    color: #6a6a6a;
}

.badge-frequency {
    background: rgba(197, 160, 89, 0.15);
    color: var(--accent);
}

.badge-easy {
    background: rgba(45, 106, 79, 0.1);
    color: var(--green-muted);
}

.badge-medium {
    background: rgba(197, 160, 89, 0.15);
    color: #9a7d40;
}

.badge-hard {
    background: rgba(155, 44, 44, 0.1);
    color: var(--red);
}

.badge-default {
    background: rgba(26, 60, 52, 0.08);
    color: var(--primary);
}

.objection-badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

/* ============================================================
   FILTERS
   ============================================================ */
.filters {
    margin-bottom: var(--space-lg);
}

.filters select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a4a4a' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E") no-repeat right 14px center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-xl) var(--space-sm) var(--space-md);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 200px;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast);
}

.filters select:hover {
    border-color: var(--accent);
}

/* ============================================================
   VERSE LOOKUP
   ============================================================ */
.verse-lookup {
    background: var(--white);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

/* ── Unified Lookup card ──────────────────────────────────── */
.lookup-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.card-clear-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 11px;
    font-family: 'Libre Baskerville', Georgia, serif;
    padding: 3px 10px;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.card-clear-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.lookup-mode-pills {
    display: flex;
    gap: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px;
}

.mode-pill {
    padding: 4px 14px;
    border: none;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.mode-pill.active {
    background: var(--primary);
    color: var(--white);
}

.mode-pill:not(.active):hover {
    color: var(--primary);
}

/* ── Compare Sources card ─────────────────────────────────── */
.compare-sources-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.compare-source-panel {
    flex: 1;
    min-width: 220px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
}

.compare-source-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.compare-vs-badge {
    align-self: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    padding: 0 var(--space-xs);
    flex-shrink: 0;
}

.compare-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    border-top: 1px solid var(--border);
    padding-top: var(--space-lg);
}

.compare-col {
    display: flex;
    flex-direction: column;
}

.compare-col-header {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--accent);
    margin-bottom: var(--space-md);
}

.compare-result-item {
    padding: var(--space-sm) var(--space-md);
    border-left: 2px solid var(--border-accent);
    margin-bottom: var(--space-sm);
}

.compare-empty,
.compare-loading {
    color: var(--text-muted);
    font-style: italic;
    font-size: 13px;
    padding: var(--space-sm);
}

@media (max-width: 600px) {
    .compare-results-grid { grid-template-columns: 1fr; }
    .compare-sources-row  { flex-direction: column; }
}

/* Hadith collection badge in search results */
.hadith-collection-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary);
    color: var(--white);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
    margin-right: 4px;
}

.hadith-number {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
    vertical-align: middle;
}

.verse-lookup h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 16px;
    color: var(--primary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.verse-lookup h3 .material-symbols-outlined {
    color: var(--accent);
}

.lookup-form {
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.input-group label {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.15em;
}

.lookup-form input,
.lookup-form select {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 13px;
    color: var(--ink-dark);
    background: var(--bg-primary);
    transition: border-color var(--transition-fast);
    width: 140px;
}

.lookup-form input:focus,
.lookup-form select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 1px var(--accent);
}

.lookup-form input[type="number"] {
    width: 80px;
}

.lookup-form select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a4a4a' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E") no-repeat right 10px center;
    padding-right: var(--space-xl);
    cursor: pointer;
    width: auto;
    min-width: 80px;
}

.verse-result {
    margin-top: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-left: 2px solid var(--accent);
    border-radius: var(--radius-sm);
}

.verse-result.empty {
    display: none;
}

.verse-reference {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

.verse-version {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
}

.verse-text {
    line-height: 1.7;
    font-size: 15px;
    color: var(--text-primary);
    font-style: italic;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 60, 52, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    animation: fadeIn 0.2s ease;
}

.modal-panel {
    background: var(--bg-primary);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: slideIn 0.3s ease;
}

.modal-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 20px;
    color: var(--primary);
    margin-bottom: var(--space-lg);
}

.modal-objection-text {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.modal-response-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-card);
}

.modal-response-label {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    margin-bottom: var(--space-sm);
}

.modal-response-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 16px;
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

.modal-response-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.65;
    margin-bottom: var(--space-md);
}

.modal-response-md h2,
.modal-response-md h3 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--primary);
    font-size: 15px;
    margin: var(--space-md) 0 var(--space-xs);
}
.modal-response-md h3 { font-size: 13px; }
.modal-response-md p { margin-bottom: var(--space-sm); }
.modal-response-md strong { color: var(--primary); }
.modal-response-md hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-md) 0;
}
.modal-response-md ul,
.modal-response-md ol {
    padding-left: 1.4em;
    margin-bottom: var(--space-sm);
}
.modal-response-md li { margin-bottom: 4px; }

.modal-key-points {
    margin-top: var(--space-md);
}

.modal-key-points strong {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.modal-key-points ul {
    margin-top: var(--space-sm);
    padding-left: var(--space-lg);
}

.modal-key-points li {
    margin: var(--space-xs) 0;
    font-size: 14px;
    color: var(--text-primary);
}

.modal-bottom-line {
    border-left: 2px solid var(--accent);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-lg);
    background: rgba(197, 160, 89, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.modal-bottom-line strong {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 0.1em;
}

.modal-bottom-line p {
    font-size: 14px;
    color: var(--ink-dark);
    font-weight: 700;
    margin-top: var(--space-xs);
}

.modal-close-btn {
    background: var(--primary);
    color: var(--accent);
    border: none;
    padding: var(--space-sm) var(--space-xl);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-fast);
    display: block;
    margin-left: auto;
}

.modal-close-btn:hover {
    background: var(--primary-dark);
}

/* ============================================================
   LOADING STATE
   ============================================================ */
.loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
}

.loading::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--bg-secondary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto var(--space-md);
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-top: 4px solid var(--accent);
    padding: var(--space-lg) var(--space-lg);
    text-align: center;
}

.footer-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.footer-subtitle {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 10px;
    color: var(--accent-muted);
    font-style: italic;
}

.footer-copyright {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: var(--space-sm);
    letter-spacing: 0.05em;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .study-panel {
        width: 100vw;
        border-left: none;
        border-top: 1px solid var(--border);
    }

}

@media (max-width: 768px) {
    header {
        padding: 10px var(--space-md);
    }

    header h1 {
        font-size: 15px;
        letter-spacing: 0.1em;
    }

    .header-icon-badge {
        width: 32px;
        height: 32px;
    }

    .header-icon-badge .material-symbols-outlined {
        font-size: 18px;
    }

    .tagline {
        font-size: 8px;
        letter-spacing: 0.2em;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 25%;
    }

    .lookup-form {
        flex-direction: column;
        align-items: stretch;
    }

    .lookup-form input,
    .lookup-form input[type="number"] {
        width: 100%;
    }

    .message-bubble {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .tab-btn .tab-label {
        display: none;
    }

    .tab-btn {
        padding: var(--space-md);
        justify-content: center;
        flex: 1;
    }

    .tab-btn .tab-icon {
        font-size: 22px;
    }

    .chat-input-container {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }

    .welcome-message h2 {
        font-size: 22px;
    }
}

/* ============================================================
   SECTION CHIP BAR — Sticky above chat input
   ============================================================ */
.section-chip-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-accent);
    background: var(--parchment-dark);
    align-items: center;
}

.chip-label {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    margin-right: 4px;
    white-space: nowrap;
}

.section-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border-accent);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--primary);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.section-chip .material-symbols-outlined {
    font-size: 16px;
}

.section-chip:hover:not(.chip-loading) {
    background: var(--accent);
    color: var(--white);
    border-color: var(--accent);
    box-shadow: var(--shadow-card);
}

.section-chip.chip-loading {
    opacity: 0.6;
    cursor: wait;
}

.section-chip.chip-loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent-muted);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: chip-spin 0.6s linear infinite;
    margin-left: 4px;
}

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

/* Fade-out animation when chip is removed */
.section-chip.chip-removing {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

/* Fade-in animation for the bar appearing */
.section-chip-bar.bar-entering {
    animation: chipBarSlideIn 0.3s ease forwards;
}

@keyframes chipBarSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Chat Mode Toggle ── */
.chat-mode-toggle {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mode-btn .material-symbols-outlined {
    font-size: 14px;
}

.mode-btn:hover {
    color: var(--primary);
    border-color: var(--accent-muted);
}

.mode-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ── Debate Predictive Suggestions ── */
.debate-autocomplete {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    overflow-x: auto;
    white-space: nowrap;
    background: var(--parchment-dark);
    border-bottom: 1px solid var(--border);
    z-index: 10;
    scrollbar-width: none;
}

.debate-autocomplete::-webkit-scrollbar {
    display: none;
}

.predict-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--white);
    color: var(--text-body);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.predict-chip:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.predict-chip .predict-match {
    font-weight: 700;
    color: var(--primary);
}

.predict-chip:hover .predict-match {
    color: var(--white);
}


/* ============================================================
   MASTER CLASS - Filter bar (religion tabs + sub-category chips)
   ============================================================ */
.mc-filters {
    padding: var(--space-sm) var(--space-md) 0;
}

/* Tabs + search sit side by side in one row */
.mc-tabs-row {
    display: flex;
    align-items: flex-end;
    gap: var(--space-md);
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-sm);
}

.mc-tabs {
    display: flex;
    gap: 6px;
    flex: 1;
    overflow: visible;
}

.mc-tab {
    padding: 8px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.mc-tab:hover {
    color: var(--primary);
}

.mc-tab.mc-tab-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.mc-tab-count {
    display: inline-block;
    background: var(--parchment-dark);
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-body);
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
}

.mc-tab.mc-tab-active .mc-tab-count {
    background: var(--primary);
    color: var(--white);
}

/* Sub-category chips */
.mc-subcats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-sm);
}

.mc-chip {
    padding: 4px 12px;
    background: var(--parchment-light);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mc-chip:hover {
    background: var(--parchment-dark);
    color: var(--primary);
    border-color: var(--primary);
}

.mc-chip.mc-chip-active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.mc-chip-count {
    font-size: 11px;
    opacity: 0.8;
    margin-left: 3px;
}

/* Search bar — sits inline to the right of the religion tabs */
.mc-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 240px;
    flex-shrink: 0;
    margin-bottom: 4px; /* align with tab underline */
}

.mc-search-icon {
    position: absolute;
    left: 10px;
    font-size: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.mc-search-input {
    width: 100%;
    padding: 6px 32px 6px 32px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--parchment-light);
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text-primary);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.mc-search-input:focus {
    outline: none;
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 63, 44, 0.1);
}

.mc-search-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.mc-search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
    line-height: 1;
    transition: all var(--transition-fast);
}

.mc-search-clear:hover {
    background: var(--parchment-dark);
    color: var(--text-primary);
}

/* Saved tab */
.mc-tab.mc-tab-saved {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mc-tab-icon {
    font-size: 15px;
    vertical-align: middle;
}

.mc-tab.mc-tab-saved.mc-tab-active .mc-tab-icon {
    color: var(--accent);
}

/* Bookmark button on cards */
.mc-fav-btn {
    margin-left: auto;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition-fast);
    line-height: 1;
}

.mc-fav-btn .material-symbols-outlined {
    font-size: 20px;
    display: block;
}

.mc-fav-btn:hover {
    color: var(--accent);
    background: var(--parchment-dark);
}

.mc-fav-btn.mc-fav-active {
    color: var(--accent);
}

.mc-fav-btn.mc-fav-active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1;
}

/* No results state */
.mc-no-results {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    color: var(--text-muted);
}

.mc-no-results .material-symbols-outlined {
    font-size: 48px;
    display: block;
    margin-bottom: var(--space-sm);
    opacity: 0.4;
}

.mc-no-results p {
    font-size: 14px;
}

/* ============================================================
   MASTER CLASS - Premium argument cards
   ============================================================ */
.masterclass-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: var(--space-md);
    padding: var(--space-md);
}

.masterclass-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.masterclass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--accent);
}

.masterclass-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: var(--space-sm);
}

.masterclass-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.masterclass-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.masterclass-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: var(--space-sm);
    padding: var(--space-sm);
    background: var(--parchment-light);
    border-radius: var(--radius-sm);
}

.masterclass-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.masterclass-meta-item .material-symbols-outlined {
    font-size: 14px;
}

.masterclass-category {
    display: inline-block;
    padding: 4px 10px;
    background: var(--accent-muted);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

.masterclass-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-md);
    font-style: italic;
}

.masterclass-view-btn {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.masterclass-view-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* ── Expanded Argument View ─────────────────────────── */
.masterclass-expanded {
    max-width: 860px;
    margin: 0 auto;
    padding: var(--space-lg);
}

.masterclass-expanded-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.mc-expand-toggle {
    flex: 1;
    display: flex;
    justify-content: center;
}

.mc-expand-all-btn {
    background: none;
    border: 1px dashed var(--border-accent);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mc-expand-all-btn:hover {
    border-style: solid;
    color: var(--primary);
    border-color: var(--primary);
}

.masterclass-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.masterclass-back-btn:hover {
    background: var(--parchment-dark);
    border-color: var(--accent);
}

/* Title + pills row */
.mc-expanded-meta {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.masterclass-expanded-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 28px;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: var(--space-xs);
}

.mc-expanded-pills {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.masterclass-expanded-category {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    padding: 3px 10px;
    border-radius: 20px;
}

.mc-step-count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ── Accordion ────────────────────────────────────────── */
.mc-accordion {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mc-acc-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.mc-acc-item.mc-acc-open {
    border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

/* Accordion header — the clickable trigger */
.mc-acc-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-fast);
}

.mc-acc-header:hover {
    background: var(--parchment-light);
}

.mc-acc-item.mc-acc-open .mc-acc-header {
    background: var(--parchment-light);
    border-bottom: 1px solid var(--border);
    /* Stick to top of scroll container so you can always collapse without scrolling back up */
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Step badge — number circle or emoji */
.mc-acc-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    font-size: 13px;
    font-weight: 800;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    font-family: var(--font-body);
}

.mc-acc-item.mc-acc-open .mc-acc-badge {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* Label — section title */
.mc-acc-label {
    flex: 1;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
}

/* Verse count chip */
.mc-acc-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.mc-acc-verses {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Chevron — rotates when open */
.mc-acc-chevron {
    font-size: 20px;
    color: var(--text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.mc-acc-item.mc-acc-open .mc-acc-chevron {
    transform: rotate(180deg);
    color: var(--accent);
}

/* Body — grid animation (modern, no max-height hacks) */
.mc-acc-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mc-acc-item.mc-acc-open .mc-acc-body {
    grid-template-rows: 1fr;
}

.mc-acc-content {
    overflow: hidden;
    padding: 0;
    transition: padding 0.35s ease;
}

.mc-acc-item.mc-acc-open .mc-acc-content {
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
}

/* Legacy section styles (used in older views) */
.masterclass-section-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
}

.masterclass-verse {
    background: var(--parchment-light);
    border-left: 4px solid var(--accent);
    padding: var(--space-sm);
    margin: var(--space-sm) 0;
    font-family: 'Libre Baskerville', Georgia, serif;
}

.masterclass-note {
    color: var(--text-muted);
    font-size: 13px;
}

.masterclass-section-content strong {
    color: var(--primary);
    font-weight: 700;
}
