body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    line-height: 1.6;
}

/* Header Styles */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px; /* Fixed height */
    display: flex;
    align-items: center;
}

.header-container {
    width: 100%;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-brand h1 {
    margin: 0;
    font-size: 1.5rem;
}

.user-welcome {
    font-size: 0.9rem;
    opacity: 0.9;
}

.header-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.nav-link:active {
    transform: translateY(0);
}

.logout-btn {
    background: rgba(255, 99, 99, 0.2);
    cursor: pointer;
    font-size: inherit;
    color: inherit;
    border: 1px solid rgba(255, 99, 99, 0.3);
}

.logout-btn:hover {
    background: rgba(255, 99, 99, 0.3);
    border-color: rgba(255, 99, 99, 0.5);
}

/* Add icons to navigation links */
.nav-link[href="/categories"]::before {
    content: "📚";
    font-size: 1.1em;
}

.nav-link[href="/stats"]::before {
    content: "📊";
    font-size: 1.1em;
}

.nav-link[href="/review"]::before {
    content: "🔄";
    font-size: 1.1em;
}

.nav-link[href="/search"]::before {
    content: "🔍";
    font-size: 1.1em;
}

.logout-btn::before {
    content: "👋";
    font-size: 1.1em;
}

/* Footer Styles */
.app-footer {
    background: #343a40;
    color: white;
    padding: 2rem 1rem;
    margin-top: auto;
    text-align: center;
}

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

.footer-container p {
    margin: 0.5rem 0;
    opacity: 0.9;
}

/* Main Content */
main {
    min-height: calc(100vh - 200px);
    max-width: 1200px;
    margin: 0 auto;
    margin-top: 80px; /* Account for fixed header */
    padding: 2rem;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 3px;
}

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

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

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

/* Mobile Navigation */
@media (max-width: 768px) {
    .app-header {
        height: 60px;
        padding: 0.5rem 1rem;
    }
    
    .header-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0;
        height: 100%;
    }
    
    .header-brand {
        display: flex;
        align-items: center;
        gap: 1rem;
    }
    
    .header-brand h1 {
        font-size: 1.1rem;
        margin: 0;
    }
    
    .user-welcome {
        font-size: 0.8rem;
        margin: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-nav {
        position: fixed;
        top: 60px;
        right: -100%;
        width: 250px;
        height: calc(100vh - 60px);
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 1rem;
        transition: right 0.3s ease;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1);
        z-index: 1000;
        overflow-y: auto;
    }
    
    .header-nav.active {
        right: 0;
    }
    
    .nav-link {
        width: 100%;
        text-align: left;
        padding: 1rem;
        margin: 0.25rem 0;
        border-radius: 8px;
        transition: all 0.3s;
        justify-content: flex-start;
    }
    
    .nav-link:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateX(5px);
    }
    
    .logout-btn {
        margin-top: auto;
        background: rgba(255, 99, 99, 0.2);
        border-color: rgba(255, 99, 99, 0.3);
    }
    
    main {
        margin-top: 80px;
        padding: 1rem;
    }
    
    /* Mobile menu overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* Old nav styles kept for compatibility */
nav {
    margin-bottom: 20px;
}

nav a {
    margin-right: 20px;
    text-decoration: none;
    color: #333;
}

.question-container {
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 5px;
}

.question-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question {
    font-size: 1.2em;
    margin-bottom: 20px;
}

.answer {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.answer-hidden {
    display: none !important;
}

.buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    font-size: 1em;
}

.button:hover {
    background-color: #0056b3;
}

.correct-btn {
    background-color: #28a745;
}

.correct-btn:hover {
    background-color: #218838;
}

.incorrect-btn {
    background-color: #dc3545;
}

.incorrect-btn:hover {
    background-color: #c82333;
}

.question-id {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
    font-weight: bold;
}

.feedback-buttons {
    display: none;
}

.review-container {
    max-width: 800px;
    margin: 0 auto;
}

.review-container h1 {
    margin-bottom: 20px;
    color: #333;
}

.review-card {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
    background-color: white;
    transition: opacity 0.5s ease-out;
}

.question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.seen-count {
    color: #666;
    font-size: 0.9em;
}

.question-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.question-text {
    font-size: 1.1em;
    line-height: 1.5;
}

.no-questions {
    text-align: center;
    padding: 40px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.no-questions p {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #28a745;
}

.review-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.mark-reviewed-btn {
    background-color: #198754;  /* Bootstrap success color */
}

.mark-reviewed-btn:hover {
    background-color: #157347;
}

.voice-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    margin-right: 8px;
    vertical-align: middle;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.voice-btn:hover {
    opacity: 1;
}

.voice-btn.speaking {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Specific styles for practice page question card */
.question-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.question-card .question {
    font-size: 1.4em;  /* Larger font for questions */
    line-height: 1.6;
    margin: 20px 0;
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.question-card .answer {
    font-size: 1.4em;  /* Larger font for answers */
    line-height: 1.6;
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.question-card .question > *:not(.voice-btn),
.question-card .answer > *:not(.voice-btn) {
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
}

/* Adjust voice button size to match larger text */
.question-card .voice-btn {
    font-size: 1.4em;
    padding: 5px;
    margin-right: 10px;
}

/* Mobile responsiveness for question cards */
@media (max-width: 768px) {
    .question-card {
        margin: 0.5rem 0;
        padding: 1rem;
    }
    
    .question-card .question {
        font-size: 1.2em;
        padding: 0.5rem;
    }
    
    .question-card .answer {
        font-size: 1.2em;
        padding: 0.75rem;
    }
    
    .question-card .voice-btn {
        font-size: 1.2em;
    }
    
    .buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .button {
        width: 100%;
        text-align: center;
    }
    
    .review-actions {
        flex-direction: row;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .review-actions .button {
        flex: 1;
        min-width: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    /* Categories page mobile */
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .category-card {
        padding: 1.5rem;
    }
    
    /* Search page mobile */
    .search-container {
        padding: 1rem;
        margin: 0 0.5rem;
    }
    
    .search-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .search-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* Review page mobile */
    .review-questions {
        gap: 1rem;
    }
    
    .review-card {
        padding: 1rem;
    }
}

/* Tag Styling - Global */
.tag-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #e8f4fd;
    color: #2563eb;
    border-radius: 12px;
    font-size: 0.85rem;
    margin: 0.25rem;
    text-decoration: none;
    cursor: default;
}

.tag-badge.category-tag {
    background: #f0f4f8;
    color: #4a5568;
}

.tag-badge.grade-tag {
    background: #fef3c7;
    color: #92400e;
}

.tag-badge.year-tag {
    background: #e0e7ff;
    color: #3730a3;
}

.question-tags {
    margin: 1rem 0;
}