/* Add this new layout container style */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Responsive: stack on mobile */
@media (max-width: 768px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }
}

/* Ensure content cards fill the space */
.two-column-layout .content-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.two-column-layout textarea {
    flex: 1;
    min-height: 150px;
}

.content-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.pulsing {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Styles for API response */
#output .correct,
#output .correct-stress,
#output .correct-sound {
    color: #16a34a;
    /* green */
    font-weight: 600;
}

#output .incorrect,
#output .incorrect-stress,
#output .incorrect-sound,
#output .missing-word {
    color: #dc2626;
    /* red */
    font-weight: 600;
    text-decoration: line-through;
}

#output .unexpected-word {
    color: #f59e0b;
    /* amber */
    font-weight: 600;
    background-color: #fffbeb;
    padding: 2px 4px;
    border-radius: 4px;
}

.loader {
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Word analysis styles */
.word-analysis-card {
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid #3b82f6;
}

.word-analysis-card.correct {
    border-left-color: #16a34a;
}

.word-analysis-card.incorrect {
    border-left-color: #dc2626;
}

.phonetic-text {
    font-family: monospace;
    color: #3b82f6;
    font-weight: 500;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-correct {
    background-color: #dcfce7;
    color: #166534;
}

.status-incorrect {
    background-color: #fee2e2;
    color: #b91c1c;
}

.audio-btn {
    background-color: #dbeafe;
    color: #1d4ed8;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    transition: all 0.2s;
}

.audio-btn:hover {
    background-color: #bfdbfe;
}

.audio-btn svg {
    margin-right: 0.5rem;
}

.score-display {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2563eb;
    background-color: #dbeafe;
    padding: 0.25rem 1rem;
    border-radius: 9999px;
}

.hidden {
    display: none;
}

/* Style Get Random Phrase button (inside first column) */
.two-column-layout .content-card:first-child button {
    background-color: #3b82f6;
    /* blue */
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.two-column-layout .content-card:first-child button:hover {
    background-color: #2563eb;
}

/* Style START RECORDING button */
#recordBtn {
    background-color: #36bf76;
    /* green */
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-block;
    /* space above the button row */
    margin-right: 10px;
}

#recordBtn:hover {
    background-color: #059669;
}

/* Style Your Audio button */
#playUserAudioBtn {
    background-color: #6b7280;
    /* gray */
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#playUserAudioBtn:hover:not(:disabled) {
    background-color: #4b5563;
}

#playUserAudioBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Make the container of Your Audio button inline, so both buttons sit side by side */
#recordBtn+div {
    display: inline-block;
    vertical-align: middle;
    margin: 0;
    padding: 0;
}

:root {
    --primary-blue: #3b82f6;
    --accent-green: #36bf76;
    --text-main: #1f2937;
    --bg-light: #f9fafb;
    --bar-bg: #e5e7eb;
}

.results-dashboard {
    padding: 1.5rem;
    border-radius: 16px !important;
    background: #ffffff;
}

.section-title {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* Prediction Badge */
.prediction-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

/* Progress Bar Styling */
.bar-group {
    margin-bottom: 1rem;
}

.bar-label-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.progress-bg {
    background: var(--bar-bg);
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-blue);
    border-radius: 10px;
    transition: width 0.8s ease-out;
}

/* Regional Grid */
.grid-bars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .grid-bars {
        grid-template-columns: 1fr;
    }
}

.small-label {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: -0.5rem;
}

/* Feedback Card */
.feedback-hero-card {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
}

.feedback-text-container {
    line-height: 1.6;
    color: #374151;
    font-size: 0.95rem;
}

.feedback-text-container b {
    color: #166534;
    background: #dcfce7;
    padding: 0 4px;
    border-radius: 4px;
}

/* Word Pills */
.word-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.score-pill {
    background: #dbeafe;
    color: #1e40af;
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 800;
}

/* Animation for bars when they appear */
.progress-fill {
    width: 0%;
    /* Start at 0 */
    animation: growBar 1.5s forwards ease-in-out;
}

@keyframes growBar {
    from {
        width: 0%;
    }

    to {
        width: var(--target-width);
    }

    /* We will set this via JS or just let the style attribute handle it */
}

/* Better spacing for the feedback */
.mt-2 {
    margin-top: 0.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

.results-dashboard {
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.results-dashboard:hover {
    border-color: #3b82f6;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.results-dashboard {
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    display: flex;
    flex-direction: column;
}

.prediction-badge {
    background: #3b82f6;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    display: inline-block;
    margin-top: 5px;
}

.bar-group {
    margin-bottom: 12px;
}

.bar-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.progress-bg {
    background: #e2e8f0;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 1s ease-in-out;
}

/* For the small grid bars */
.grid-bars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* --- Modern Bar Styles --- */

/* The container for a single bar row */
.bar-group {
    margin-bottom: 16px;
    opacity: 0;
    animation: fadeSlideIn 0.5s ease forwards;
}

/* Stagger animation for list items */
.bar-group:nth-child(1) { animation-delay: 0.1s; }
.bar-group:nth-child(2) { animation-delay: 0.2s; }
.bar-group:nth-child(3) { animation-delay: 0.3s; }
.bar-group:nth-child(4) { animation-delay: 0.4s; }

.bar-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

.country-label {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between flag and text */
}

.flag-icon {
    font-size: 1.2em;
    line-height: 1;
}

/* The background track */
.progress-bg {
    background: #f1f5f9; /* Lighter, cleaner gray */
    height: 12px;        /* Slightly thicker */
    border-radius: 99px; /* Pill shape */
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

/* The filling bar */
.progress-fill {
    height: 100%;
    border-radius: 99px;
    width: 0%; /* Start at 0 for animation */
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1); /* Smooth eased animation */
}

/* --- Color Variants --- */

/* Top Result (The Winner) - Green/Teal Gradient */
.fill-hero {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

/* Secondary Results - Blue Gradient */
.fill-secondary {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

/* Tertiary/Low Results - Gray/Slate */
.fill-tertiary {
    background: #94a3b8;
}

/* --- Regional Grid Specifics --- */
.grid-bars .bar-group {
    margin-bottom: 10px;
}

.grid-bars .progress-bg {
    height: 6px; /* Thinner bars for regional data */
}

.grid-bars .progress-fill {
    background: #64748b; /* Neutral color for secondary data */
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}