/* ===========================
   Reset & Base Styles
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Kalimat-themed Color Palette */
    --primary-blue: #2c3761;
    --primary-blue-light: #3d4a7a;
    --primary-blue-dark: #1e2643;
    --accent-teal: #4db8a8;
    --accent-teal-light: #6dccc0;
    --accent-teal-dark: #3a9689;
    --white: #ffffff;
    --cream: #f8f9fa;
    --gray-light: #e9ecef;
    --gray: #6c757d;
    --gray-dark: #343a40;
    --error-red: #dc3545;
    --success-green: #28a745;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.2);
    
    /* Typography */
    --font-arabic: 'Amiri', 'Cairo', serif;
    --font-ui: 'Cairo', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    background: var(--cream);
    color: var(--gray-dark);
    line-height: 1.6;
    min-height: 100vh;
    direction: rtl;
}

/* ===========================
   Container & Layout
   =========================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===========================
   Header
   =========================== */
.header {
    text-align: center;
    padding: var(--spacing-lg) 0 var(--spacing-md);
    animation: fadeInDown 0.6s ease-out;
}

.header-content {
    position: relative;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-xs);
}

.icon-mosque {
    width: 300px;
    height: auto;
    max-height: 100px;
    filter: drop-shadow(0 2px 8px rgba(44, 55, 97, 0.1));
    object-fit: contain;
}

.header h1 {
    font-family: var(--font-arabic);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary-blue);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin: 0;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1rem;
    color: var(--gray);
    font-weight: 400;
    margin-top: var(--spacing-xs);
    opacity: 0.85;
}

/* ===========================
   Main Content
   =========================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* ===========================
   Search Container
   =========================== */
.search-container {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg) var(--spacing-xl);
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.6s ease-out;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--gray-light);
}

/* Decorative pattern - subtle */
.search-container::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, var(--accent-teal) 1px, transparent 1px);
    background-size: 15px 15px;
    opacity: 0.05;
    pointer-events: none;
}

.search-form {
    margin-bottom: var(--spacing-md);
}

.search-box {
    display: flex;
    gap: var(--spacing-sm);
    align-items: stretch;
}

.search-input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 1rem;
    font-family: var(--font-ui);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-md);
    background: var(--white);
    transition: all 0.3s ease;
    direction: rtl;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-teal);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(77, 184, 168, 0.1);
}

.search-input::placeholder {
    color: var(--gray);
    opacity: 0.7;
}

.search-button {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-button:hover {
    background: var(--primary-blue-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.search-button:active {
    transform: translateY(0);
}

.search-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.icon-search {
    width: 18px;
    height: 18px;
}

.voice-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm);
    background: var(--white);
    color: var(--accent-teal);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 48px;
}

.voice-button:hover {
    background: var(--cream);
    border-color: var(--accent-teal);
    color: var(--accent-teal-dark);
}

.voice-button.recording {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-color: #e74c3c;
    color: var(--white);
    animation: pulse 1.5s ease-in-out infinite;
}

.voice-button.loading {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-color: #f39c12;
    color: var(--white);
}

.voice-button.loading .icon-mic {
    animation: spin 1s linear infinite;
}

.voice-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.voice-button.loading:disabled {
    opacity: 1;
}

.icon-mic {
    width: 24px;
    height: 24px;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
}

/* ===========================
   Waveform Visualization
   =========================== */
.waveform-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.waveform-canvas {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-sm);
    background: #ffffff;
    display: block;
    margin-bottom: var(--spacing-xs);
}

.waveform-status {
    color: var(--gray);
    font-size: 0.9rem;
    margin: 0;
    font-weight: 500;
}

/* ===========================
   Example Queries
   =========================== */
.example-queries {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    align-items: center;
    justify-content: center;
    margin-top: var(--spacing-sm);
}

.example-label {
    font-size: 0.85rem;
    color: var(--gray);
    font-weight: 500;
}

.example-btn {
    padding: 6px 14px;
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 20px;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--gray-dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-btn:hover {
    background: var(--cream);
    border-color: var(--accent-teal);
    color: var(--primary-blue);
}

/* ===========================
   Loading State
   =========================== */
.loading-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.3s ease-out;
    transition: all 0.3s ease;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--spacing-md);
    border: 4px solid var(--gray-light);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 1.1rem;
    color: var(--gray);
    font-weight: 300;
}

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

/* ===========================
   Skeleton Loading
   =========================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


.skeleton-intent {
    background: linear-gradient(135deg, var(--white) 0%, var(--cream) 100%);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-light);
    border-right: 3px solid var(--accent-teal);
    animation: fadeInUp 0.5s ease-out;
}

.skeleton-intent-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--gray-light);
}

.skeleton-intent-icon {
    width: 20px;
    height: 20px;
    background: var(--accent-teal);
    border-radius: 6px;
    opacity: 0.4;
}

.skeleton-intent-title {
    height: 16px;
    width: 140px;
    background: var(--primary-blue);
    border-radius: 4px;
    opacity: 0.35;
}

.skeleton-intent-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.skeleton-intent-line {
    height: 16px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.skeleton-intent-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
    animation: shimmer-pass 1.5s infinite;
}

.skeleton-meta-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
}

.skeleton-meta-label,
.skeleton-meta-value,
.skeleton-meta-pill {
    display: inline-block;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton-meta-label,
.skeleton-meta-value {
    background: var(--gray-light);
    height: 14px;
}

.skeleton-meta-label { width: 90px; }
.skeleton-meta-label.short { width: 70px; }

.skeleton-meta-value { width: 160px; }
.skeleton-meta-value.wide { width: 220px; }

.skeleton-meta-pill {
    height: 18px;
    width: 100px;
    background: rgba(77, 184, 168, 0.4);
}

.skeleton-meta-label::before,
.skeleton-meta-value::before,
.skeleton-meta-pill::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: shimmer-pass 1.5s infinite;
}

@keyframes shimmer-pass {
    0% { left: -100%; }
    100% { left: 100%; }
}

.skeleton-answer {
    background: linear-gradient(135deg, var(--white) 0%, var(--cream) 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    border-right: 4px solid var(--accent-teal);
    animation: fadeInUp 0.6s ease-out;
}

.skeleton-answer-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--accent-teal-light);
}

.skeleton-answer-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-teal);
    border-radius: 50%;
    opacity: 0.5;
}

.skeleton-answer-title {
    height: 28px;
    width: 100px;
    background: var(--primary-blue);
    border-radius: 4px;
    opacity: 0.5;
}

.skeleton-answer-content {
    padding: var(--spacing-md);
    background: var(--white);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.skeleton-answer-line {
    height: 20px;
    background: var(--gray-light);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.skeleton-answer-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: shimmer-pass 1.5s infinite;
}

.skeleton-answer-line:nth-child(1) { width: 100%; }
.skeleton-answer-line:nth-child(2) { width: 95%; }
.skeleton-answer-line:nth-child(3) { width: 88%; }

.skeleton-sources {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.7s ease-out;
}

.skeleton-sources-header {
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.skeleton-sources-icon {
    width: 20px;
    height: 20px;
    background: var(--primary-blue);
    border-radius: 4px;
    opacity: 0.5;
}

.skeleton-sources-title {
    height: 20px;
    width: 100px;
    background: var(--primary-blue);
    border-radius: 4px;
    opacity: 0.5;
}

.skeleton-sources-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.skeleton-source-card {
    background: var(--cream);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border-right: 3px solid var(--accent-teal);
}

.skeleton-source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.skeleton-source-ref {
    height: 16px;
    width: 120px;
    background: var(--gray-light);
    border-radius: 4px;
}

.skeleton-source-badge {
    height: 20px;
    width: 60px;
    background: var(--gray-light);
    border-radius: 12px;
}

.skeleton-source-text {
    height: 60px;
    background: var(--white);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

.skeleton-source-text::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    animation: shimmer-pass 1.5s infinite;
}

/* ===========================
   Results Container
   =========================== */
.results-container {
    animation: fadeInUp 0.6s ease-out;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

/* ===========================
   Intent Info Card (Non-Search Intents)
   =========================== */
.intent-info-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    border-right: 3px solid var(--success-green);
    animation: fadeInUp 0.5s ease-out;
}

.intent-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid #a5d6a7;
}

.icon-intent {
    width: 20px;
    height: 20px;
    color: var(--success-green);
}

.intent-header h3 {
    font-family: var(--font-arabic);
    font-size: 1rem;
    color: var(--success-green);
    font-weight: 600;
    margin: 0;
}

.intent-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.intent-type {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--white);
    border-radius: var(--radius-sm);
}

.intent-label {
    font-weight: 700;
    color: var(--gray-dark);
    font-size: 0.9rem;
}

.intent-name {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-blue);
    color: var(--white);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-arabic);
}

.intent-entities {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.intent-entity-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--white);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.intent-entity-item:hover {
    transform: translateX(-2px);
    box-shadow: var(--shadow-sm);
}

.entity-label {
    font-weight: 600;
    color: var(--gray-dark);
    font-size: 0.85rem;
    min-width: 100px;
}

.entity-value {
    font-family: var(--font-arabic);
    color: var(--success-green);
    font-size: 0.9rem;
    font-weight: 600;
}

.no-entities {
    padding: var(--spacing-sm);
    text-align: center;
    color: var(--gray);
    font-size: 0.9rem;
    font-style: italic;
}

/* ===========================
   Search Metadata Card
   =========================== */
.search-metadata-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    border-right: 3px solid var(--accent-teal);
    animation: fadeInUp 0.5s ease-out;
}

.metadata-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
}

.icon-metadata {
    width: 18px;
    height: 18px;
    color: var(--accent-teal);
}

.metadata-header h3 {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--primary-blue);
    font-weight: 600;
    margin: 0;
}

.metadata-content {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    align-items: center;
}

.metadata-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
}

.metadata-label {
    font-weight: 500;
    color: var(--gray);
    font-size: 0.85rem;
}

.metadata-value {
    font-family: var(--font-ui);
    color: var(--gray-dark);
    font-size: 0.85rem;
}

.metadata-query {
    font-weight: 600;
    color: var(--primary-blue);
}

.metadata-index {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent-teal);
    color: var(--white);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.metadata-optimized {
    font-weight: 600;
    color: var(--accent-teal-dark);
    font-style: italic;
}

.stage-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
    color: var(--gray);
    animation: slideInRight 0.4s ease-out;
}

.stage-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gray-light);
    border: 2px solid var(--gray);
}

.stage-dot.completed {
    background: var(--accent-teal);
    border-color: var(--accent-teal);
    box-shadow: 0 0 8px rgba(77, 184, 168, 0.4);
}

/* ===========================
   Answer Box
   =========================== */
.answer-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    border-right: 4px solid var(--accent-teal);
    animation: fadeInUp 0.6s ease-out;
}

.answer-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--accent-teal);
}

.icon-answer {
    width: 28px;
    height: 28px;
    color: var(--accent-teal);
}

.answer-header h2 {
    font-family: var(--font-arabic);
    font-size: 1.5rem;
    color: var(--primary-blue);
    font-weight: 700;
    margin: 0;
}

.answer-content {
    font-family: var(--font-arabic);
    font-size: 1.2rem;
    line-height: 2;
    color: var(--gray-dark);
    padding: var(--spacing-sm) 0;
}

/* No Match Content (shown in answer box) */
.no-match-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--spacing-md) 0;
    gap: var(--spacing-sm);
}

.no-match-content .icon-info {
    width: 48px;
    height: 48px;
    color: var(--accent-teal);
    opacity: 0.8;
}

.no-match-content p {
    font-size: 1.1rem;
    color: var(--gray);
    margin: 0;
    line-height: 1.8;
}

.alt-index-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-md);
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--cream);
    color: var(--primary-blue);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.alt-index-btn:hover {
    background: var(--white);
    border-color: var(--accent-teal);
    color: var(--accent-teal-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.alt-index-btn:active {
    transform: translateY(0);
}

.icon-switch {
    width: 18px;
    height: 18px;
}

.timing-info {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    border-top: 2px solid #e0e0e0;
}

.timing-info h4 {
    font-size: 0.85rem;
    color: var(--gray);
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-sm);
}

.timing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--white);
    border-radius: var(--radius-sm);
    border-right: 3px solid var(--accent-teal);
}

.timing-label {
    font-size: 0.9rem;
    color: var(--gray-dark);
    font-weight: 500;
}

.timing-value {
    font-size: 0.95rem;
    color: var(--accent-teal);
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.timing-total {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: var(--white);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
}

.timing-total .timing-label {
    color: var(--white);
    font-size: 1rem;
}

.timing-total .timing-value {
    color: var(--accent-teal-light);
    font-size: 1.1rem;
}

/* ===========================
   Sources Container
   =========================== */
.sources-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    box-shadow: var(--shadow-sm);
    animation: fadeInUp 0.7s ease-out;
    border: 1px solid var(--gray-light);
}

.sources-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: transparent;
    border: none;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-blue);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: var(--radius-sm);
}

.sources-toggle:hover {
    background: var(--gray-light);
}

.icon-expand {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.sources-toggle.expanded .icon-expand {
    transform: rotate(180deg);
}

.sources-count {
    display: inline-block;
    padding: 2px 8px;
    background: var(--primary-blue);
    color: var(--white);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
}

.sources-list {
    padding-top: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.source-card {
    background: var(--cream);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border-right: 3px solid var(--accent-teal);
    transition: all 0.3s ease;
}

.source-card:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-sm);
}

/* Quran Verse Header */
.source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.source-reference {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 0.95rem;
}

.source-type {
    padding: 4px 10px;
    background: var(--accent-teal);
    color: var(--white);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Hadith Header */
.hadith-header {
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid #e0e0e0;
}

.hadith-meta-top {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    align-items: center;
    margin-bottom: var(--spacing-xs);
}

.hadith-source {
    padding: 4px 12px;
    background: var(--primary-blue);
    color: var(--white);
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
}

.hadith-number {
    padding: 4px 10px;
    background: var(--accent-teal-light);
    color: var(--primary-blue-dark);
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.hadith-grade {
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.grade-sahih {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.grade-hasan {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.grade-weak {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.grade-default {
    background: var(--gray-light);
    color: var(--gray-dark);
    border: 1px solid #e0e0e0;
}

.hadith-chapter {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 500;
    font-family: var(--font-arabic);
}

/* Source Text */
.source-text {
    font-family: var(--font-arabic);
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--gray-dark);
    direction: rtl;
}

.hadith-text {
    font-size: 1.1rem;
    line-height: 2;
}

/* ===========================
   No Answer Box
   =========================== */
.no-answer-box {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    box-shadow: var(--shadow-md);
    border-right: 4px solid #ffc107;
    margin-bottom: var(--spacing-md);
    animation: fadeInUp 0.5s ease-out;
}

.icon-no-answer {
    width: 48px;
    height: 48px;
    color: var(--primary-blue);
    margin: 0 auto var(--spacing-sm);
    display: block;
}

.no-answer-message {
    font-size: 1.1rem;
    color: var(--gray-dark);
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.no-answer-message strong {
    color: #f57c00;
    font-weight: 700;
}

.no-answer-hint {
    font-size: 0.95rem;
    color: var(--gray);
    margin-bottom: var(--spacing-md);
}

.alt-search-button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: linear-gradient(135deg, var(--accent-teal) 0%, var(--accent-teal-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-ui);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.alt-search-button:hover {
    background: linear-gradient(135deg, var(--accent-teal-light) 0%, var(--accent-teal) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.alt-search-button:active {
    transform: translateY(0);
}

.icon-alt-search {
    width: 20px;
    height: 20px;
}

/* ===========================
   Error Box
   =========================== */
.error-box {
    background: linear-gradient(135deg, #fef3f2 0%, #fce8e6 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    border-right: 4px solid var(--error-red);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    animation: fadeInUp 0.6s ease-out;
}

.icon-error {
    width: 40px;
    height: 40px;
    color: var(--error-red);
    flex-shrink: 0;
}

.error-box p {
    font-size: 1.1rem;
    color: var(--error-red);
    font-weight: 500;
}

/* ===========================
   Footer
   =========================== */
.footer {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-lg);
    background: transparent;
    color: var(--gray-dark);
    animation: fadeIn 0.8s ease-out;
    border-top: 1px solid var(--gray-light);
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-xl);
}

.footer-section {
    flex: 1;
    min-width: 180px;
}

.footer-section h4 {
    color: var(--primary-blue);
    font-size: 0.95rem;
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-section p {
    margin: var(--spacing-xs) 0;
    font-size: 0.9rem;
    line-height: 1.8;
}

.footer-section a {
    color: var(--gray-dark);
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-section a:hover {
    color: var(--accent-teal);
}

.footer-copyright {
    flex: 2;
    min-width: 280px;
    text-align: center;
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--gray-light);
}

.footer-copyright p {
    font-size: 0.85rem;
    color: var(--gray);
}

.disclaimer {
    margin-top: var(--spacing-xs);
    font-size: 0.8rem;
    color: var(--gray);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--spacing-lg);
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-copyright {
        width: 100%;
    }
}

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

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    .icon-mosque {
        width: 220px;
        max-height: 80px;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .search-container {
        padding: var(--spacing-md);
    }
    
    .search-box {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
    
    .search-input {
        width: 100%;
    }
    
    .search-button {
        justify-content: center;
        width: 100%;
    }
    
    .voice-button {
        width: 100%;
    }
    
    .answer-content {
        font-size: 1.1rem;
        padding: var(--spacing-xs) 0;
    }
    
    .answer-box {
        padding: var(--spacing-md);
    }
    
    .example-queries {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: var(--spacing-sm);
    }
    
    .icon-mosque {
        width: 180px;
        max-height: 60px;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .search-input {
        font-size: 0.95rem;
    }
    
    .answer-header h2 {
        font-size: 1.3rem;
    }
    
    .answer-content {
        font-size: 1rem;
    }
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    .search-container,
    .footer,
    .sources-toggle {
        display: none;
    }
    
    .sources-list {
        display: flex !important;
    }
    
    body {
        background: white;
    }
}
