/* Custom Uthmanic Font */
@font-face {
    font-family: 'KFGQPC Uthmanic';
    src: url('assets/fonts/KFGQPC-HAFS Uthmanic-V22.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
}

/* HERO SECTION */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    background: url('assets/hero-bg.png') top center / cover no-repeat;
    background-size: 100% 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-logo {
    position: absolute;
    top: 2rem;
    left: 2rem;
    width: 120px;
    height: auto;
    z-index: 10;
}

/* Optional overlay for better text readability */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0);
    z-index: 1;
}

.hero-content {
    text-align: center;
    z-index: 10;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 90vh;
    position: relative;
}

.hero-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

.hero-title {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(3.5rem, 12vw, 9rem);
    font-weight: 300;
    color: #1a1a1a;
    margin: 0;
    padding: 0 0 1rem 0;
    line-height: 1.0;
    letter-spacing: -0.03em;
}

.hero-subtitle {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1.25rem, 3.5vw, 2.5rem);
    font-weight: 300;
    color: #4a4a4a;
    margin: 0 0 4rem 0;
    letter-spacing: 0.01em;
}

.hero-features {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 0;
    font-family: 'Nunito', sans-serif;
    font-size: clamp(0.875rem, 1.8vw, 1.125rem);
    color: #333;
    font-weight: 400;
}

.hero-feature {
    white-space: nowrap;
    font-family: 'Nunito', sans-serif;
}

.hero-divider {
    color: #666;
    font-weight: 300;
    margin: 0 0.5rem;
}

.hero-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 3rem;
    margin-top: auto;
    z-index: 10;
}

.cta-text {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1.25rem, 3vw, 2rem);
    color: #333;
    font-weight: 400;
    margin: 0;
}

.scroll-button {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background-color: white;
    border: 2px solid #000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    animation: bounce 2s infinite;
}

.scroll-button:hover {
    transform: translateY(5px);
    background-color: #6b7cf1;
    border: 2px solid #00000000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.scroll-button svg {
    width: 24px;
    height: 24px;
    stroke: #000;
    stroke-width: 2;
    fill: none;
}

.scroll-button:hover svg {
    stroke: #ffffff;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* TESTING SECTION */
.testing-section {
    min-height: 100vh;
    padding: 4rem 0;
    align-content: center;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 0;
    position: relative;
    display: flex;
    gap: 3rem;
}

/* Stepper sidebar */
.stepper {
    width: 60px;
    flex-shrink: 0;
    position: relative;
}

/* Vertical line */
.stepper-line {
    position: absolute;
    left: 50%;
    top: calc(44px + 0.875rem);
    transform: translateX(-50%);
    width: 2px;
    bottom: calc(44px + 0.875rem);
    background: #cbd5e1;
    z-index: 1;
}

.stepper-line-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: #6b7cf1;
    transition: height 0.3s ease;
}

/* Step circles */
.step-circle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    color: white;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(203, 213, 225, 0.3);
}

.step-circle[data-step="1"] {
    top: 0.875rem;
}

.step-circle.completed,
.step-circle.active {
    background: #6b7cf1;
    box-shadow: 0 2px 8px rgba(107, 124, 241, 0.3);
}

/* Content area */
.content {
    flex: 1;
}

/* Section card styling */
.section {
    background: #e8e9f0;
    border-radius: 16px;
    padding: 1.75rem 2rem;
    margin-bottom: 2rem;
}

/* Section titles */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

/* Select dropdown */
.select-box {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    width: 100%;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 20px;
    padding-right: 2.5rem;
}

.select-box:hover {
    border-color: #6b7cf1;
    outline: none;
}

.select-box:focus {
    outline: none;
    border-color: #6b7cf1;
}

/* Preview section */
.preview-header {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.preview-text {
    background: white;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    font-family: 'KFGQPC Uthmanic', 'Noto Sans Arabic', sans-serif;
    direction: rtl;
    text-align: center;
    line-height: 2;
    font-size: 1.15rem;
    color: #1e293b;
}

/* Simple mode toggle */
.mode-toggle-card {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    background: linear-gradient(135deg, rgba(15,23,42,0.02), rgba(14,165,233,0.05));
    backdrop-filter: blur(3px);
}

.mode-toggle-text {
    flex: 1;
}

.mode-toggle-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.mode-toggle-subtitle {
    font-size: 0.95rem;
    color: #475569;
}

.mode-toggle-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mode-toggle-status {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mode-toggle-status.simple {
    background: #22d3ee24;
    color: #0f172a;
}

.mode-toggle-switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 30px;
}

.mode-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5f5;
    border-radius: 999px;
    transition: background-color 0.25s ease;
}

.mode-toggle-slider::before {
    position: absolute;
    content: '';
    height: 22px;
    width: 22px;
    left: 4px;
    top: 4px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 8px 15px rgba(15, 23, 42, 0.15);
    transition: transform 0.25s ease;
}

.mode-toggle-switch input:checked + .mode-toggle-slider {
    background: linear-gradient(120deg, #0ea5e9, #8b5cf6);
}

.mode-toggle-switch input:checked + .mode-toggle-slider::before {
    transform: translateX(24px);
}

/* Radio buttons */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radio-option {
    background: white;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    border-color: #6b7cf1;
}

.radio-option.selected {
    border-color: #6b7cf1;
}

.radio-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 60px;
}

.radio-circle {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.radio-option.selected .radio-circle {
    border-color: #6b7cf1;
    background: white;
}

.radio-option.selected .radio-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b7cf1;
}

.radio-label {
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
}

/* File upload area */
.upload-area {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: none;
    min-height: 280px;
}

.radio-option.selected .upload-area {
    display: block;
}

.upload-box {
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-box:hover {
    border-color: #6b7cf1;
    background: #f0f4ff;
}

.upload-box:hover .browse-button {
    background: #6b7cf1;
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    opacity: 0.6;
}

.upload-text {
    font-size: 1rem;
    color: #4b5563;
    margin-bottom: 0.5rem;
}

.upload-limit {
    font-size: 0.875rem;
    color: #6b7280;
}

.browse-button {
    background: #1e293b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 0.75rem;
    transition: background 0.2s ease;
}

.browse-button:hover {
    background: #334155;
}

/* Audio recorder - Streamlit style */
.recorder-area {
    cursor: default;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: none;
    /* min-height: 280px; */
}

.radio-option.selected .recorder-area {
    display: block;
}

.streamlit-recorder {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Initial recorder state with big mic icon */
.recorder-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
}

.recorder-initial:hover {
    background: #f9fafb;
}

.big-mic-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b7cf1 0%, #8b5cf6 100%);
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(107, 124, 241, 0.3);
}

.recorder-initial:hover .big-mic-icon {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(107, 124, 241, 0.4);
}

.recorder-initial:active .big-mic-icon {
    transform: scale(0.98);
}

.recorder-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.recorder-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.start-btn {
    background: #6b7cf1;
    color: white;
    border-color: #6b7cf1;
}

.start-btn:hover {
    background: #5a6dd8;
    border-color: #5a6dd8;
}

.stop-btn {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.stop-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.recording-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse-animation 1.5s ease-in-out infinite;
}

@keyframes pulse-animation {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.recording-time {
    font-size: 1rem;
    font-weight: 600;
    color: #991b1b;
    font-variant-numeric: tabular-nums;
}

/* Waveform container */
.waveform-container {
    border-radius: 8px;
    display: none;
    position: relative;
}

.waveform-container.active {
    display: block;
}

.waveform-layout {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.waveform-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #6b7cf1;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.waveform-btn:hover {
    background: #5a6ae0;
    transform: scale(1.05);
}

.waveform-btn.recording {
    background: #ef4444;
}

.waveform-btn.recording:hover {
    background: #dc2626;
}

.waveform-btn.play-btn {
    background: #6b7cf1;
    color: white;
}

.waveform-btn.play-btn:hover {
    background: #5a6dd8;
}

.waveform-center {
    flex: 1;
    min-width: 0;
}

.waveform-time {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: #374151;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    min-width: 45px;
    text-align: right;
}

.record-again-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    width: 100%;
}

.record-again-btn:hover {
    background: #f9fafb;
    border-color: #6b7cf1;
    color: #6b7cf1;
}

.record-again-btn svg {
    color: currentColor;
    stroke: currentColor;
}

.record-again-btn-inline {
    display: none;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    margin-left: auto;
    border: none;
    border-radius: 6px;
    background: #fee;
    color: #dc2626;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.record-again-btn-inline:hover {
    background: #fecaca;
}

.record-again-btn-inline svg {
    flex-shrink: 0;
}

.waveform-canvas {
    width: 100%;
    height: 80px;
    display: block;
    border-radius: 6px;
}

/* Results waveform player */
.results-waveform-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
}

/* Predict button */
.predict-button {
    background: linear-gradient(135deg, #6b7cf1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.125rem;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(107, 124, 241, 0.3);
}

.predict-button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 124, 241, 0.4);
}

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

.predict-button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

/* Results container */
#resultsContainer {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    display: none;
}

#resultsContainer.active {
    display: block;
}

.back-button {
    background: white;
    color: #1e293b;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: 0.875rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.back-button:hover {
    background: #f9fafb;
    border-color: #6b7cf1;
    color: #6b7cf1;
    transform: translateX(-4px);
}

.back-button svg {
    width: 20px;
    height: 20px;
}

.results-section {
    background: #e8e9f0;
    border-radius: 16px;
    padding: 2rem;
}

.results-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

.annotation-panel {
    background: #13151f;
    border-radius: 16px;
    padding: 1.5rem;
    color: #f8fafc;
    min-width: 0;
    margin-top: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.annotation-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.annotation-console {
    background: #0b0c12;
    border-radius: 12px;
    padding: 1rem;
    font-family: 'Courier New', 'Noto Sans Arabic', monospace;
    font-size: 0.9rem;
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.console-row {
    margin-bottom: 0.75rem;
}

.console-row:last-of-type {
    margin-bottom: 0;
}

.console-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.console-value {
    width: 100%;
    white-space: pre; /* preserve spacing and prevent wrapping */
    overflow-x: auto; /* allow horizontal scrolling for long phoneme lines */
    overflow-y: auto; /* vertical scrolling if needed */
    max-height: 140px; /* keep console height reasonable and show scrollbar */
    color: #e2e8f0;
    margin-top: 0.25rem;
    direction: rtl;
    text-align: right;
    font-family: 'Courier New', monospace; /* fixed-width for alignment */
}

.annotation-field-label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.annotation-textarea,
.annotation-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.75rem 0.85rem;
    font-family: 'Courier New', 'Noto Sans Arabic', monospace;
    font-size: 0.95rem;
    resize: vertical;
    white-space: pre;
    overflow-x: auto;
    overflow-y: auto;
    word-break: normal;
    word-wrap: normal;
    direction: rtl;
    text-align: right;
}

.annotation-textarea:focus,
.annotation-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.save-annotation-button {
    width: 100%;
    margin-top: 1.25rem;
    background: linear-gradient(135deg, #22d3ee, #6366f1);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.save-annotation-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.annotation-status {
    min-height: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

/* Annotation Library Page */
.annotation-hero {
    background: linear-gradient(120deg, #f7f7fb, #eef0ff);
    padding: 4rem 2rem 2rem;
}

.annotation-hero-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    align-items: center;
}

.annotation-hero-content h1 {
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    margin-bottom: 0.5rem;
    color: #111827;
}

.annotation-hero-subtitle {
    font-size: 1.1rem;
    color: #475569;
    max-width: 540px;
}

.annotation-kicker {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.85rem;
    color: #818cf8;
    margin-bottom: 1rem;
}

.annotation-hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pill-link {
    padding: 0.85rem 1.75rem;
    border-radius: 999px;
    border: 2px solid transparent;
    background: #111827;
    color: white;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pill-link.secondary {
    background: transparent;
    color: #111827;
    border-color: #111827;
}

.pill-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.annotation-library {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 1.5rem 5rem;
}

.annotation-toolbar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.filter-field input,
.filter-field select {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.refresh-button {
    align-self: stretch;
    border: none;
    border-radius: 12px;
    background: #6b7cf1;
    color: white;
    font-weight: 600;
    cursor: pointer;
    padding: 0.75rem 1.5rem;
    transition: background 0.2s ease;
}

.refresh-button:hover {
    background: #5a6de0;
}

.annotation-status-line {
    min-height: 1.5rem;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    color: #475569;
}

.annotation-status-line.success {
    color: #16a34a;
}

.annotation-status-line.error {
    color: #dc2626;
}

.annotation-status-line.info {
    color: #2563eb;
}

.annotation-status-line.muted {
    color: #94a3b8;
}

.annotation-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.annotation-card {
    background: white;
    border-radius: 18px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.05);
}

/* Visual hint for completed annotation cards */
.annotation-card.annotation-card-completed {
    border-left: 4px solid #10b981; /* green */
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.06);
}

.annotation-complete-badge svg {
    vertical-align: middle;
}

.annotation-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.annotation-card-title h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.annotation-card-title p {
    font-size: 0.9rem;
    color: #94a3b8;
}

.annotation-card-badges {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-end;
}

.annotation-badge {
    background: #eef2ff;
    color: #4338ca;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.annotation-badge.mode-simple {
    background: rgba(14, 165, 233, 0.12);
    color: #0369a1;
}

.annotation-badge.mode-full {
    background: rgba(99, 102, 241, 0.12);
    color: #3730a3;
}

.annotation-audio audio {
    width: 100%;
}

.annotation-audio-missing {
    background: #fef3c7;
    border: 1px dashed #f59e0b;
    padding: 0.85rem;
    border-radius: 10px;
    color: #92400e;
    text-align: center;
}

.annotation-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.annotation-field label {
    font-size: 0.85rem;
    font-weight: 600;
    display: block;
    margin-bottom: 0.35rem;
    color: #475569;
}

.annotation-field textarea,
.annotation-field input {
    width: 100%;
    border: 1px solid #cbd5f5;
    border-radius: 10px;
    padding: 0.75rem;
    font-size: 0.95rem;
}
.annotation-field input {
    font-family: 'Inter', sans-serif;
}
.annotation-field textarea {
    font-family: 'Courier New', monospace; /* fixed width for annotations in list */
    white-space: pre; /* don't wrap unless there's a newline */
    overflow-x: auto; /* horizontal scroll for long lines */
    overflow-y: auto;
    word-break: normal;
    word-wrap: normal;
    max-height: 240px;
    direction: rtl;
    text-align: right;
}

.annotation-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.annotation-footer-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.link-button {
    background: none;
    border: none;
    color: #6366f1;
    font-weight: 600;
    cursor: pointer;
}

.annotation-update-status {
    font-size: 0.9rem;
}

.annotation-console-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #0f172a;
    border-radius: 12px;
    padding: 0 1rem;
}

.annotation-card.console-open .annotation-console-panel {
    max-height: 320px;
    padding: 1rem;
}

.annotation-console-json {
    font-family: 'Courier New', 'Fira Code', monospace;
    color: #e2e8f0;
    font-size: 0.85rem;
    white-space: pre; /* preserve formatting and prevent wrapping */
    overflow-x: auto; /* allow horizontal scroll for long JSON */
    overflow-y: auto;
    max-height: 320px; /* ensure panel has a max height and scrollbars appear */
}

.annotation-empty {
    padding: 2rem;
    text-align: center;
    border: 2px dashed #c7d2fe;
    border-radius: 18px;
    color: #6b7280;
    grid-column: 1 / -1;
}

.annotation-empty.error {
    border-color: #fecaca;
    color: #b91c1c;
}

.annotation-card.dirty {
    border-color: #f97316;
}

/* Word-level diff styling */
.word {
    display: inline;
    transition: all 0.2s ease;
}

.word-correct {
    color: #1e293b;
}

.word-error {
    color: #ef4444;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    padding-bottom: 20px;
    transition: opacity 0.2s ease;
}

.word-error:hover {
    opacity: 0.8;
}

.error-dots {
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    height: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.error-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #ef4444;
    flex-shrink: 0;
}

.variant-dots {
    position: absolute;
    bottom: 2px;
    left: 0;
    right: 0;
    height: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.word-insertion {
    color: #16a34a;
    font-weight: 600;
}

.annotation-diff-empty {
    color: #64748b;
    font-size: 0.95rem;
}

.variant-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #8b5cf6;
    flex-shrink: 0;
}

.phoneme-tooltip {
    position: fixed;
    background: white;
    border: 1px solid #e5e7eb;
    padding: 0.75rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 250px;
    font-size: 0.875rem;
    pointer-events: none;
}

/* Consistent scrollbar styling (webkit + Firefox) for consoles and annotation fields */
.console-value,
.annotation-console-json,
.annotation-field textarea,
.annotation-textarea {
    scrollbar-width: thin;
    scrollbar-color: rgba(107,124,241,0.6) rgba(0,0,0,0.06);
}

/* WebKit scrollbar styles */
.console-value::-webkit-scrollbar,
.annotation-console-json::-webkit-scrollbar,
.annotation-field textarea::-webkit-scrollbar,
.annotation-textarea::-webkit-scrollbar {
    height: 12px;
    width: 12px;
}
.console-value::-webkit-scrollbar-thumb,
.annotation-console-json::-webkit-scrollbar-thumb,
.annotation-field textarea::-webkit-scrollbar-thumb,
.annotation-textarea::-webkit-scrollbar-thumb {
    background: rgba(107,124,241,0.6);
    border-radius: 8px;
}
.console-value::-webkit-scrollbar-track,
.annotation-console-json::-webkit-scrollbar-track,
.annotation-field textarea::-webkit-scrollbar-track,
.annotation-textarea::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.06);
    border-radius: 8px;
}

/* Annotation card per-item diff container */
.annotation-diff {
    font-family: 'KFGQPC Uthmanic', 'Noto Sans Arabic', sans-serif;
    direction: rtl;
    text-align: right;
    font-size: 1.25rem;
    line-height: 1.8;
    word-break: normal;
}

.phoneme-tooltip strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* Skeleton Loader */
.skeleton-loader {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.skeleton-loader h3 {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #1e293b;
}

.skeleton-waveform {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.skeleton-play-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    flex-shrink: 0;
}

.skeleton-waveform-bar {
    flex: 1;
    height: 60px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-time {
    width: 50px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    flex-shrink: 0;
}

.skeleton-recitation {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.skeleton-line {
    height: 36px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin-bottom: 1rem;
}

.skeleton-line:last-of-type {
    width: 70%;
    margin-left: auto;
    margin-right: auto;
}

.skeleton-dots {
    height: 8px;
    width: 60%;
    margin: 1rem auto 0;
    border-radius: 4px;
    background: linear-gradient(90deg, #fecaca 25%, #fca5a5 50%, #fecaca 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-hint {
    height: 20px;
    width: 70%;
    margin: 0 auto;
    border-radius: 4px;
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    .mode-toggle-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-features {
        flex-direction: column;
        gap: 1rem;
    }

    .container {
        gap: 2rem;
        padding: 2rem 1.5rem;
    }

    .stepper {
        width: 50px;
    }

    .step-circle {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

    .container {
        flex-direction: column;
        gap: 1rem;
        padding: 2rem 1rem;
    }

    .stepper {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        padding-top: 0;
        max-width: 300px;
        margin: 0 auto;
    }

    .step-circle:not(:last-child) {
        margin-bottom: 0;
    }

    .stepper-line {
        display: none;
    }

    .content {
        padding-top: 0;
    }
}

/* Annotation Detail Page */
.detail-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.back-link {
    color: #64748b;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}
.back-link:hover {
    color: #0f172a;
}
.detail-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    margin-bottom: 2rem;
}
.word-annotation-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 15px rgba(0,0,0,0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    padding: 2rem;
    overflow-y: auto;
}
.word-annotation-panel.open {
    transform: translateX(0);
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.close-panel {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}
.selected-word-display {
    font-family: 'Noto Sans Arabic', sans-serif;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}
.word.has-annotation {
    border-bottom: 2px solid #3b82f6;
}
.word {
    cursor: pointer;
}
.word:hover {
    background-color: #f1f5f9;
    border-radius: 4px;
}

.annotation-diff-container {
    background-color: #f8fafc;
    border-radius: 12px;
    padding: 2rem;
    margin: 1rem 0;
    border: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
}

.annotation-diff {
    font-size: 1.75rem;
    line-height: 2.5;
    text-align: center;
}

.diff-hint {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 1rem;
    font-style: italic;
}

.word {
    padding: 0.25rem 0.1rem;
    border-radius: 4px;
    margin: 0 0.1rem;
}

.word:hover {
    background-color: #e2e8f0;
}

.word.has-annotation {
    background-color: rgba(59, 130, 246, 0.1);
    border-bottom: 2px solid #3b82f6;
}

/* Fixes for Detail Page */
.detail-actions .save-annotation-button {
    width: auto;
    margin-top: 0;
    padding: 0.75rem 1.5rem;
}

.close-panel {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.25rem;
    line-height: 1;
    padding-bottom: 2px; /* Visual alignment for x */
}

.close-panel:hover {
    background: #e2e8f0;
    color: #ef4444;
}

.word-annotation-panel .annotation-textarea {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    min-height: 150px;
}

.word-annotation-panel .annotation-textarea:focus {
    background: white;
    border-color: #3b82f6;
}
