/* CSS Variables for easy theming */
:root {
    --primary-color: #4A90E2;
    --secondary-color: #50E3C2;
    --background-color: #f0f4f8;
    --card-background: #ffffff;
    --text-color: #333333;
    --input-border: #cccccc;
    --button-hover: #357ABD;
    --footer-background: #4A90E2;
    --footer-text: #ffffff;
    --feature-icon-color: #50E3C2;
    --nav-background: #ffffff;
    --nav-text-color: #333333;
    --nav-hover-background: #f0f0f0;
    --nav-hover-text-color: #4A90E2;
    --card-hover: #f9f9f9;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --button-color: #4A90E2;
    --button-text-color: #ffffff;
}

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

html, body {
    height: 100%;
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--button-hover);
}

/* Flexbox Layout */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Styles */
header {
    background-color: var(--nav-background);
    padding: 20px 0;
    box-shadow: 0 2px 4px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 30px;
}

nav ul li a {
    font-weight: 500;
    color: var(--nav-text-color);
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

nav ul li a:hover {
    background-color: var(--nav-hover-background);
    color: var(--nav-hover-text-color);
}

/* Main Content Container */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 20px;
    background-color: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 4px 6px var(--shadow-color);
}

/* Section Styles */
.section {
    margin-bottom: 40px;
}

.section h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

/* Standard Applet Styles */
.preview-window {
    width: 100%;
    min-height: 400px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background-color: #f9f9f9;
    box-sizing: border-box;
}

/* Flashcard, Notes, and Quiz Buttons */
.flashcard-buttons, .difficulty-buttons, .quiz-options button {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.flashcard-buttons button, .difficulty-buttons button, .quiz-options button {
    margin: 0 10px;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--button-text-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.flashcard-buttons button:hover, .difficulty-buttons button:hover, .quiz-options button:hover {
    background-color: var(--button-hover);
}

/* Hidden class for toggling visibility */
.hidden {
    display: none;
}

/* Progress Bar Styles */
.progress-bar {
    width: 100%;
    background-color: #f1f1f1;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar-inner {
    height: 20px;
    background-color: var(--primary-color);
    transition: width 0.3s;
}

/* Review Section Styles */
.review-section table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.review-section th, .review-section td {
    padding: 8px;
    border: 1px solid var(--input-border);
}

.review-section th {
    background-color: #f2f2f2;
}

/* Loading Spinner */
.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s infinite linear;
    margin: 20px auto;
}

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

/* Footer Styles */
footer {
    background-color: var(--footer-background);
    color: var(--footer-text);
    padding: 20px 0;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-links a {
    color: var(--footer-text);
}

.footer-links a:hover {
    color: var(--button-hover);
}
    /* Mobile vs. Desktop UI tweaks */
    /* Mobile: focus on touch readability & stacked layouts */
    @media (max-width: 768px) {
        body {
            background-color: #ffffff !important;
            padding-top: 70px !important; /* avoid content under fixed header */
        }

        header {
            padding: 14px 16px !important;
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            background: rgba(255, 255, 255, 0.93) !important;
            backdrop-filter: blur(10px) !important;
            z-index: 1000 !important;
        }

        nav {
            position: fixed !important;
            bottom: 0 !important;
            left: 0 !important;
            width: 100% !important;
            background: rgba(255, 255, 255, 0.95) !important;
            box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.1) !important;
            padding: 8px 0 !important;
            z-index: 1001 !important;
        }

        nav ul {
            flex-direction: row !important;
            justify-content: space-around !important;
            gap: 0 !important;
        }

        nav ul li {
            margin: 0 !important;
        }

        nav ul li a {
            padding: 10px 8px !important;
            font-size: 0.9rem !important;
        }

        .container {
            margin: 16px !important;
            padding: 16px !important;
            border-radius: 12px !important;
            box-shadow: none !important;
        }

        .hero {
            padding: 60px 16px !important;
        }

        .hero h1 {
            font-size: 2.2rem !important;
        }

        .hero p {
            font-size: 1rem !important;
        }

        .mobile-only {
            display: block !important;
        }

        .desktop-only {
            display: none !important;
        }
    }

    /* Desktop: broader layout with more spacing */
    @media (min-width: 769px) {
        body {
            background-color: var(--background-color) !important;
        }

        .mobile-only {
            display: none !important;
        }

        .desktop-only {
            display: block !important;
        }
    }