/* ==========================================
   ITALŠTINA PRO ČECHY - DESIGN SYSTEM & CSS
   Modern, responsive, dark/light theme support
   ========================================== */

:root {
    /* Color Palette - Light Mode */
    --it-green: #008c45;
    --it-green-hover: #006633;
    --it-green-light: #e8f5e9;
    --it-red: #cd212a;
    --it-red-hover: #a51820;
    --it-red-light: #ffebee;
    --it-white: #ffffff;

    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-secondary: #f1f5f9;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-surface: #1e293b;
    --bg-card: #1e293b;
    --bg-secondary: #334155;

    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --text-light: #64748b;

    --border-color: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);

    --it-green-light: rgba(0, 140, 69, 0.15);
    --it-red-light: rgba(205, 33, 42, 0.15);
}

/* Global Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

a {
    color: var(--it-green);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--it-green-hover);
}

/* App Container Layout */
.app-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

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

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.brand-flag {
    width: 32px;
    height: 22px;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    display: inline-flex;
    overflow: hidden;
}
.flag-g { width: 33.33%; background: var(--it-green); }
.flag-w { width: 33.33%; background: #ffffff; }
.flag-r { width: 33.33%; background: var(--it-red); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--it-green);
    background-color: var(--it-green-light);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Main Container */
.main-wrapper {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 20px;
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--it-green), var(--it-green-hover));
    color: white;
    box-shadow: 0 4px 12px rgba(0,140,69,0.25);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,140,69,0.35);
    color: white;
}

.btn-accent {
    background: linear-gradient(135deg, var(--it-red), var(--it-red-hover));
    color: white;
    box-shadow: 0 4px 12px rgba(205,33,42,0.25);
}
.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(205,33,42,0.35);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    border-color: var(--it-green);
    color: var(--it-green);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-audio {
    background: var(--it-green-light);
    color: var(--it-green);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.btn-audio:hover {
    transform: scale(1.1);
    background: var(--it-green);
    color: white;
}

/* Cards & Widgets */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

/* Progress Bars */
.progress-bar-container {
    width: 100%;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-full);
    height: 10px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--it-green), #22c55e);
    border-radius: var(--radius-full);
    transition: width 0.5s ease-in-out;
}

/* Badges & Tags */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-a1 { background: #dcfce7; color: #15803d; }
.badge-a2 { background: #e0f2fe; color: #0369a1; }
.badge-b1 { background: #fef9c3; color: #a16207; }
.badge-b2 { background: #ffedd5; color: #c2410c; }
.badge-c1 { background: #f3e8ff; color: #7e22ce; }

.badge-xp { background: #fef08a; color: #854d0e; }
.badge-streak { background: #fee2e2; color: var(--it-red); }

/* Dictionary & Lists */
.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    background: var(--bg-card);
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.input-text {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 14px;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
}

.select-box {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
}

/* Dictionary Card */
.word-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}

.word-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.word-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--it-green);
    margin-bottom: 4px;
}

.word-pronunciation {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
}

.word-translation {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 8px 0;
}

.word-example {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--it-green);
    margin: 8px 0;
}

/* Flashcards Component */
.flashcard-container {
    perspective: 1000px;
    max-width: 500px;
    margin: 30px auto;
    height: 300px;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

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

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
}

/* Spaced Repetition Rating Buttons */
.srs-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* Table styling for Grammar */
.grammar-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.grammar-table th, .grammar-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.grammar-table th {
    background-color: var(--it-green-light);
    color: var(--it-green);
    font-weight: 700;
}

/* Test Engine */
.test-box {
    max-width: 700px;
    margin: 0 auto;
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.option-btn {
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.option-btn:hover {
    border-color: var(--it-green);
    background: var(--it-green-light);
}

.option-btn.selected {
    border-color: var(--it-green);
    background: var(--it-green-light);
    font-weight: 700;
}

.option-btn.correct {
    border-color: #22c55e;
    background: #dcfce7;
    color: #15803d;
}

.option-btn.wrong {
    border-color: var(--it-red);
    background: var(--it-red-light);
    color: var(--it-red);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    color: var(--text-main);
    border-left: 5px solid var(--it-green);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive Mobile Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 8px 12px;
    z-index: 1000;
    justify-content: space-around;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
}

.mobile-nav-item.active {
    color: var(--it-green);
    font-weight: 700;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-main);
    cursor: pointer;
}

@media (max-width: 900px) {
    .nav-links {
        display: none;
    }
    .hamburger-btn {
        display: block;
    }
    .mobile-bottom-nav {
        display: flex;
    }
    .main-wrapper {
        padding-bottom: 80px;
    }
}
