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

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #6366f1;
}

.nav-logo i {
    margin-right: 10px;
    font-size: 1.8rem;
}

.nav-greeting {
    color: #64748b;
    font-size: 1rem;
    font-weight: 500;
}

.nav-greeting strong {
    color: #6366f1;
    font-weight: 600;
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    transition: transform 0.3s ease;
}

.menu-toggle:hover {
    transform: scale(1.1);
}

.menu-toggle.active .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.bar {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Vertical Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #6366f1;
}

.sidebar-logo i {
    margin-right: 10px;
    font-size: 1.5rem;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease, transform 0.3s ease;
    border-radius: 4px;
}

.sidebar-close:hover {
    color: #6366f1;
    transform: rotate(90deg);
    background: #f1f5f9;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

.sidebar-item {
    margin: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-link:hover {
    background: #f8fafc;
    color: #6366f1;
    border-left-color: #6366f1;
}

.sidebar-link.active {
    background: #f1f5f9;
    color: #6366f1;
    border-left-color: #6366f1;
    font-weight: 600;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.main-content {
    margin-top: 70px;
}

.section {
    display: block;
    min-height: calc(100vh - 70px);
    padding: 80px 0;
}

/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero-content {
    animation: slideInLeft 1s ease-out;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #64748b;
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #6366f1;
    color: white;
}

.btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: #6366f1;
    border: 2px solid #6366f1;
}

.btn-secondary:hover {
    background: #6366f1;
    color: white;
    transform: translateY(-2px);
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: slideInRight 1s ease-out;
}

.floating-card {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
    animation: float 3s ease-in-out infinite;
}

.floating-card i {
    font-size: 3rem;
    color: #6366f1;
    margin-bottom: 1rem;
}

.floating-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.floating-card p {
    color: #64748b;
}

/* Section Titles */
.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 3rem;
}

/* Flashcard Stats Section */
.flashcard-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Circular stats (New, Started, Learned, Mastered) */
.stats-circles {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
}

.stat-circle {
    min-width: 48px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: white;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: default;
    transition: transform 0.2s ease;
}

.stat-circle:hover {
    transform: translateY(-2px);
}

.stat-circle .stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
}

/* Colors for circular stats */
.stat-new {
    background: #f97316;
}

.stat-new:hover {
    background: #ea580c;
}

.stat-started {
    background: #f59e0b;
}

.stat-started:hover {
    background: #d97706;
}

.stat-learned {
    background: #6366f1;
}

.stat-learned:hover {
    background: #4f46e5;
}

.stat-mastered {
    background: #10b981;
}

.stat-mastered:hover {
    background: #059669;
}

/* Tooltip for circular stats */
.stat-circle::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, 6px);
    background: #0f172a;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transition-delay: 0s;
    z-index: 2;
}

.stat-circle::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    transition-delay: 0s;
    z-index: 2;
}

.stat-circle:hover::after,
.stat-circle:hover::before {
    opacity: 1;
    transform: translate(-50%, 0);
    transition-delay: 0.5s;
}

.stat-circle:hover::before {
    transform: translateX(-50%);
}

/* Rectangular stats (Due, Word Bank) */
.stats-rectangles {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.stat-rectangle {
    background: #6366f1;
    color: white;
    font-size: 1.125rem;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    cursor: default;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.stat-rectangle:hover {
    transform: translateY(-2px);
}

.stat-rectangle .stat-value {
    font-size: 1.125rem;
    font-weight: 500;
    color: white;
}

/* Colors for rectangular stats */
.stat-due {
    background: #ef4444;
}

.stat-due:hover {
    background: #dc2626;
}

.stat-total {
    background: #64748b;
}

.stat-total:hover {
    background: #475569;
}

/* Tooltip for rectangular stats */
.stat-rectangle::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, 6px);
    background: #0f172a;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transition-delay: 0s;
    z-index: 2;
}

.stat-rectangle::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    transition-delay: 0s;
    z-index: 2;
}

.stat-rectangle:hover::after,
.stat-rectangle:hover::before {
    opacity: 1;
    transform: translate(-50%, 0);
    transition-delay: 0.5s;
}

.stat-rectangle:hover::before {
    transform: translateX(-50%);
}

/* Mobile responsive stats */
@media (max-width: 768px) {
    .stats-circles {
        gap: 0.5rem;
    }
    
    .stat-circle {
        min-width: 40px;
        width: 40px;
        height: 40px;
    }
    
    .stat-circle .stat-value {
        font-size: 1rem;
    }
    
    .stats-rectangles {
        gap: 0.75rem;
    }
    
    .stat-rectangle {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .stat-rectangle .stat-value {
        font-size: 1rem;
    }
}

/* Word Progress Badge in Word Details Modal */
.word-progress-badge {
    background: #6366f1;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-0.60rem);
}

.word-progress-badge.progress-new {
    background: #f97316;
}

.word-progress-badge.progress-started {
    background: #f59e0b;
}

.word-progress-badge.progress-learned {
    background: #6366f1;
}

.word-progress-badge.progress-mastered {
    background: #10b981;
}

/* Flashcards Section */
.flashcard-container {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}


/* Flashcard */
.flashcard-wrapper {
    perspective: 1000px;
    height: 400px;
    position: relative;
    transition: height 0.6s ease;
}

/* Increase height when card is flipped to accommodate more content on back */
.flashcard-wrapper.card-flipped {
    height: 600px;
}

.flashcard {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
}

.card-back {
    transform: rotateY(180deg);
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Word Display */
.word-display {
    margin-bottom: 2rem;
}

.chinese-character {
    font-size: 4rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
    line-height: 1;
    animation: fadeInUp 0.8s ease-out;
}

.pinyin {
    font-size: 1.5rem;
    color: #6366f1;
    font-weight: 500;
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.english-meaning {
    font-size: 2rem;
    color: #059669;
    font-weight: 600;
    margin-top: 1rem;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

/* Example Sentence */
.example-sentence {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #6366f1;
    max-width: 100%;
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.sentence-pinyin {
    font-size: 1.125rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.sentence-chinese-wrapper {
    margin-bottom: 0.5rem;
}

.sentence-chinese-wrapper-front {
    margin-bottom: 0.5rem;
}

.sentence-chinese {
    font-size: 1.25rem;
    color: #1e293b;
    margin: 0;
    display: inline;
}

.sentence-english {
    font-size: 1.125rem;
    color: #059669;
    font-weight: 500;
}

/* Warning Button */
.warning-button {
    background: none;
    border: none;
    color: #f59e0b;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.warning-button:hover {
    background-color: rgba(245, 158, 11, 0.1);
    color: #d97706;
    transform: scale(1.1);
}

.warning-button:active {
    transform: scale(0.95);
}

.warning-button:focus {
    outline: 2px solid #f59e0b;
    outline-offset: 2px;
}

.warning-button i {
    font-size: 1rem;
}

/* Tooltip for warning button */
.warning-button::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, 6px);
    background: #f59e0b;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 400;
    white-space: nowrap;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transition-delay: 0s;
    z-index: 2;
}

.warning-button::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #f59e0b transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    transition-delay: 0s;
    z-index: 2;
}

.warning-button:hover::after,
.warning-button:hover::before {
    opacity: 1;
    transform: translate(-50%, 0);
    transition-delay: 0.5s;
}

.warning-button:hover::before {
    transform: translateX(-50%);
}

/* Card Actions */
.card-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.btn-flip {
    background: #6366f1;
    color: white;
    font-size: 1.125rem;
    padding: 1rem 2rem;
    animation: fadeInUp 0.8s ease-out 0.8s both;
}

.btn-flip:hover {
    background: #4f46e5;
    transform: translateY(-2px);
}

/* Reduce width of buttons on front of card */
.card-front .card-actions .btn {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Score Buttons */
.score-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

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

.btn-again:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-hard {
    background: #f59e0b;
    color: white;
}

.btn-hard:hover {
    background: #d97706;
    transform: translateY(-2px);
}

.btn-good {
    background: #6366f1; /* blue */
    color: white;
}

.btn-good:hover {
    background: #4f46e5; /* darker blue */
    transform: translateY(-2px);
}

.btn-easy {
    background: #10b981; /* green */
    color: white;
}

.btn-easy:hover {
    background: #059669; /* darker green */
    transform: translateY(-2px);
}

.btn-skip {
    background: #64748b;
    color: white;
    font-size: 1.125rem;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-skip:hover {
    background: #475569;
    transform: translateY(-2px);
}

.btn-next {
    background: #6366f1;
    color: white;
    font-size: 1.125rem;
    padding: 0;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    width: 50%;
    /* Ensure same height as rating buttons (48px) */
    min-height: 48px;
    height: 48px;
    max-height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-next:hover {
    background: #4f46e5;
    transform: translateY(-2px);
}

/* Reduce size of skip button on back of card */
.card-back .card-actions .btn-skip {
    width: 50%;
    padding-top: 0.67rem;
    padding-bottom: 0.67rem;
}

/* Icon-only score buttons */
.score-buttons .btn:not(.btn-skip) {
    min-width: 48px;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-buttons .btn i {
    font-size: 1.125rem;
}

/* Tooltip for score buttons */
.score-buttons .btn::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, 6px);
    background: #0f172a;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    transition-delay: 0s;
    z-index: 2;
}

.score-buttons .btn::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
    opacity: 0;
    transition: opacity 0.15s ease;
    transition-delay: 0s;
}

.score-buttons .btn:hover::after,
.score-buttons .btn:focus-visible::after,
.score-buttons .btn:hover::before,
.score-buttons .btn:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, 0);
    transition-delay: 0.7s;
}

@media (max-width: 640px) {
    .score-buttons .btn::after {
        bottom: auto;
        top: calc(100% + 10px);
        transform: translate(-50%, -6px);
    }

    .score-buttons .btn::before {
        bottom: auto;
        top: calc(100% + 3px);
        border-color: transparent transparent #0f172a transparent;
    }

    .score-buttons .btn:hover::after,
    .score-buttons .btn:focus-visible::after {
        transform: translate(-50%, 0);
    }
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.about-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.about-card:hover {
    transform: translateY(-5px);
}

.card-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.card-icon i {
    font-size: 2rem;
    color: white;
}

.about-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #1e293b;
}

.about-card p {
    color: #64748b;
    line-height: 1.6;
}

/* FAQ Section */
.faq-content {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.faq-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -2px rgba(0, 0, 0, 0.15);
}

.faq-question {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

.faq-answer {
    color: #64748b;
    line-height: 1.8;
}

.faq-answer p {
    margin-bottom: 1rem;
}

.faq-answer ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.faq-answer ul li {
    margin-bottom: 0.5rem;
    list-style-type: disc;
}

/* Contact Section */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item {
    width: 100%;
}

.contact-item i {
    font-size: 1.5rem;
    color: #6366f1;
    margin-top: 0.25rem;
}

.contact-iframe-wrapper {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.contact-iframe-wrapper iframe {
    width: 100%;
    height: 721px;
    border: none;
    display: block;
}

.contact-item h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.contact-item p {
    color: #64748b;
}

.contact-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Footer */
.footer {
    background: #1e293b;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: #6366f1;
}

.footer-section p {
    color: #94a3b8;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #6366f1;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #374151;
    color: #94a3b8;
}

/* Animations */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation classes for info icons and next button */
.info-button.animate-in,
.explanation-icon.animate-in,
.btn-next.animate-in {
    animation: fadeInScale 0.7s ease-out forwards;
}

/* Ensure info icons maintain their size even when hidden to prevent layout shift */
.info-button {
    /* Force consistent dimensions: font-size 1.25rem + padding 0.25rem 0.5rem */
    min-width: 2.25rem; /* 1.25rem icon + 0.5rem left + 0.5rem right */
    width: 2.25rem;
    min-height: 1.75rem; /* 1.25rem icon + 0.25rem top + 0.25rem bottom */
    height: 1.75rem;
    max-height: 1.75rem;
    box-sizing: border-box;
    overflow: hidden;
}

/* Ensure icon inside is always rendered to maintain button size */
.info-button i {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    line-height: 1.25rem;
    font-size: 1.25rem;
    vertical-align: middle;
}

.explanation-icon {
    /* Force consistent dimensions: font-size 1.2rem + padding 0.25rem */
    min-width: 1.7rem; /* 1.2rem icon + 0.25rem left + 0.25rem right */
    width: 1.7rem;
    min-height: 1.7rem; /* 1.2rem icon + 0.25rem top + 0.25rem bottom */
    height: 1.7rem;
    max-height: 1.7rem;
    box-sizing: border-box;
    overflow: hidden;
}

/* Ensure icon inside is always rendered to maintain button size */
.explanation-icon i {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    line-height: 1.2rem;
    font-size: 1.2rem;
    vertical-align: middle;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes cardSlideOut {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-100px) scale(0.8);
    }
}

@keyframes cardSlideIn {
    0% {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Card transition animations */
.flashcard.transitioning-out {
    animation: cardSlideOut 0.5s ease-in-out forwards;
}

.flashcard.transitioning-in {
    animation: cardSlideIn 0.5s ease-in-out forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-left {
        gap: 1rem;
    }

    .nav-logo {
        font-size: 1.25rem;
    }

    .nav-logo i {
        font-size: 1.5rem;
    }

    .nav-greeting {
        font-size: 0.9rem;
    }

    .sidebar {
        width: 280px;
    }

    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-iframe-wrapper {
        max-width: 100%;
        padding: 0 1rem;
    }

    .contact-iframe-wrapper iframe {
        height: 600px;
    }

    .section-title {
        font-size: 1.75rem;
        white-space: nowrap;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .flashcard-wrapper {
        height: 350px;
    }
    
    .flashcard-wrapper.card-flipped {
        height: 550px;
    }

    .chinese-character {
        font-size: 3rem;
    }

    .english-meaning {
        font-size: 1rem;
    }

    .score-buttons {
        gap: 0.5rem;
    }

}

@media (max-width: 480px) {
    .nav-greeting {
        font-size: 0.85rem;
    }

    .sidebar {
        width: 100%;
        max-width: 280px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .contact-iframe-wrapper {
        padding: 0 0.5rem;
    }

    .contact-iframe-wrapper iframe {
        height: 500px;
    }

    .btn {
        width: 100%;
        max-width: 200px;
    }

    .flashcard-wrapper {
        height: 300px;
    }
    
    .flashcard-wrapper.card-flipped {
        height: 500px;
    }

    .chinese-character {
        font-size: 2.5rem;
    }

    .pinyin {
        font-size: 1.25rem;
    }

    .english-meaning {
        font-size: 0.9rem;
    }

    .card-front,
    .card-back {
        padding: 1.5rem;
    }

    .example-sentence {
        padding: 1rem;
    }
}

/* Authentication Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f8fafc;
    padding: 20px;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #1e293b;
    font-size: 2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-form label {
    font-weight: 500;
    color: #1e293b;
}

.auth-form input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: #6366f1;
}

.auth-form .error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: #64748b;
}

.auth-link a {
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover {
    text-decoration: underline;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Word Bank Section */
.wordbank-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.wordbank-form-container,
.wordbank-list-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.wordbank-form-container h3,
.wordbank-list-container h3 {
    margin-bottom: 1.5rem;
    color: #1e293b;
}

.wordbank-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.word-list {
    max-height: 500px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    min-height: 60px;
    height: 60px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.word-main {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
    min-width: 0; /* Allow flex items to shrink below content size */
    width: 100%;
    box-sizing: border-box;
}

.word-character {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    flex-shrink: 0;
}

.word-pinyin {
    color: #6366f1;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.word-meaning {
    color: #64748b;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    transition: color 0.3s ease;
    text-decoration: none;
}

.word-meaning:hover {
    color: #059669;
}

.word-meaning:active,
.word-meaning:focus {
    text-decoration: none;
    outline: none;
}

.word-meaning-expanded {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-wrap: break-word;
    word-break: break-word;
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
}

.word-item.word-item-expanded {
    height: auto;
    min-height: 60px;
    align-items: flex-start;
    padding-top: 1rem;
    padding-bottom: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.word-main.word-main-expanded {
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
    flex-direction: column;
}

.word-main.word-main-expanded .word-character,
.word-main.word-main-expanded .word-pinyin {
    flex-shrink: 0;
}

.word-main.word-main-expanded .word-meaning {
    width: 100%;
    flex: 1 1 100%;
}

.btn-small {
    padding: 0.5rem 0.75rem;
    min-width: auto;
    font-size: 0.875rem;
}

/* Word Bank Search */
.wordbank-search-container {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.wordbank-search-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.wordbank-search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    color: #1e293b;
    background: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wordbank-search-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.wordbank-search-input::placeholder {
    color: #94a3b8;
}

.wordbank-search-button,
.wordbank-clear-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    background: #6366f1;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    min-width: 44px;
    height: 44px;
}

.wordbank-search-button:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

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

.wordbank-clear-button {
    background: #64748b;
}

.wordbank-clear-button:hover {
    background: #475569;
}

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

@media (max-width: 768px) {
    .wordbank-content {
        grid-template-columns: 1fr;
    }
    
    .wordbank-search-input-wrapper {
        flex-wrap: wrap;
    }
    
    .wordbank-search-input {
        width: 100%;
    }
    
    .wordbank-search-button,
    .wordbank-clear-button {
        flex: 1;
        min-width: auto;
    }
}

/* Explanation Icon */
.explanation-icon {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    margin: 0;
    transition: all 0.2s ease;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1;
    display: none; /* Hidden by default, shown via JavaScript when sentence_id exists */
    /* Fixed dimensions to prevent layout shift */
    min-width: 1.7rem;
    width: 1.7rem;
    min-height: 1.7rem;
    height: 1.7rem;
    max-height: 1.7rem;
    box-sizing: border-box;
    overflow: hidden;
}

.explanation-icon[style*="inline-block"] {
    display: inline-block !important;
}

.explanation-icon:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    transform: scale(1.1);
}

.explanation-icon:active {
    transform: scale(0.95);
}

.explanation-icon:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* TTS Button */
.tts-button {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tts-button:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    transform: scale(1.1);
}

.tts-button:active {
    transform: scale(0.95);
}

.tts-button:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.tts-button i {
    font-size: 1rem;
}

/* Inline TTS button for popup text */
.tts-button-inline {
    font-size: 0.875rem;
    padding: 0.125rem 0.375rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.tts-button-inline i {
    font-size: 0.875rem;
}

/* Orange button state for audio generation in progress (503 response) */
.tts-button-generating {
    color: #f97316 !important; /* Orange color */
}

.tts-button-generating:hover {
    color: #ea580c !important; /* Darker orange on hover */
    background-color: rgba(249, 115, 22, 0.1) !important;
}

/* Orange state for explanation icon (503 response) */
.explanation-icon-generating {
    color: #f97316 !important; /* Orange color */
}

.explanation-icon-generating:hover {
    color: #ea580c !important; /* Darker orange on hover */
    background-color: rgba(249, 115, 22, 0.1) !important;
}

/* Orange state for info button (503 response) */
.info-button-generating {
    color: #f97316 !important; /* Orange color */
}

.info-button-generating:hover {
    color: #ea580c !important; /* Darker orange on hover */
    background-color: rgba(249, 115, 22, 0.1) !important;
}

/* Info Button */
.info-button {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Fixed dimensions to prevent layout shift */
    min-width: 2.25rem;
    width: 2.25rem;
    min-height: 1.75rem;
    height: 1.75rem;
    max-height: 1.75rem;
    box-sizing: border-box;
    overflow: hidden;
}

.info-button:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    transform: scale(1.1);
}

.info-button:active {
    transform: scale(0.95);
}

.info-button:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* .info-button i font-size is defined in the placeholder section above */

/* Pinyin Toggle Button */
.pinyin-toggle-button {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pinyin-toggle-button:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: #4f46e5;
    transform: scale(1.1);
}

.pinyin-toggle-button:active {
    transform: scale(0.95);
}

.pinyin-toggle-button:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.pinyin-toggle-button i {
    font-size: 1rem;
}

/* Word Details Section */
.word-details-section {
    margin-bottom: 1.5rem;
}

.word-details-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.word-details-section p {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Explanation Popup Overlay */
.explanation-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

/* Explanation Popup */
.explanation-popup {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 2rem;
    margin: 1rem;
}

.explanation-popup-close {
    position: sticky;
    bottom: -1.5rem;
    right: -1rem;
    float: right;
    clear: both;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 1;
    margin-top: 1rem;
    width: fit-content;
    margin-right: -1rem;
    margin-bottom: -2rem;
    transform: translateX(2rem);
}

.explanation-popup-close:hover {
    color: #1e293b;
}

.explanation-popup-close.close-gray {
    color: #64748b;
}

.explanation-popup-close.close-gray:hover {
    color: #1e293b;
}

.explanation-popup-close.close-red {
    color: #ef4444;
}

.explanation-popup-close.close-red:hover {
    color: #dc2626;
}

.explanation-popup-close:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Explanation Content */
.explanation-content {
    position: relative;
}

.explanation-loading {
    text-align: center;
    padding: 2rem;
}

.explanation-loading .spinner {
    margin: 0 auto 1rem;
}

.explanation-header h3 {
    margin-bottom: 1.5rem;
    color: #1e293b;
    font-size: 1.5rem;
}

.explanation-badges {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.explanation-badge {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-block;
}

.explanation-badge.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.explanation-badge.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.explanation-text {
    margin-bottom: 2rem;
    line-height: 1.7;
    color: #334155;
    font-size: 1rem;
}

.alternatives-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.alternatives-section h4 {
    margin-bottom: 1rem;
    color: #1e293b;
    font-size: 1.25rem;
}

.alternatives-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alternative-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alternative-item:last-child {
    margin-bottom: 0;
}

.alternative-sentence {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alternative-zh-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-start;
}

.alternative-zh {
    font-size: 1.25rem;
    color: #1e293b;
    font-weight: 500;
    margin: 0;
}

.tts-button-alternative {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 1;
    transition: color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
}

.tts-button-alternative:hover {
    color: #4f46e5;
    transform: scale(1.1);
}

.tts-button-alternative:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.alternative-pinyin {
    font-size: 0.9rem;
    color: #6366f1;
    margin: 0;
}

.alternative-en {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
}

.alternative-note {
    font-size: 0.875rem;
    color: #475569;
    font-style: italic;
    margin: 0.5rem 0 0 0;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

.explanation-error {
    text-align: center;
    padding: 2rem;
    color: #dc2626;
}

.explanation-popup-footer {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Responsive Design for Explanation Popup */
@media (max-width: 768px) {
    .explanation-popup {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
    }
    
    .explanation-popup-close {
        top: 0.75rem;
        right: 0.75rem;
        font-size: 1.25rem;
    }
    
    .explanation-header h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .explanation-badges {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .alternative-zh {
        font-size: 1.1rem;
    }
}


/* Error Modal */
.error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.error-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10001;
}

.error-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: #fef2f2;
}

.error-modal-header h3 {
    margin: 0;
    color: #dc2626;
    font-size: 1.5rem;
    font-weight: 600;
}

.error-modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.error-modal-body p {
    margin: 0 0 1rem 0;
    color: #333;
    line-height: 1.6;
}

.error-id {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: #666;
}

.error-id code {
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #1f2937;
    word-break: break-all;
}

.error-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.error-modal-close-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.error-modal-close-btn:hover {
    background: #b91c1c;
}

.error-modal-close-btn:active {
    background: #991b1b;
}

/* Responsive Design for Error Modal */
@media (max-width: 768px) {
    .error-modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .error-modal-header,
    .error-modal-body,
    .error-modal-footer {
        padding: 1rem;
    }
    
    .error-modal-header h3 {
        font-size: 1.25rem;
    }
}
