:root {
    /* Conjugation highlighting colors */
    --color-ending: #1565c0;        /* Blue: regular/predictable endings */
    --color-irregular: #e74c3c;     /* Red: true irregularities */
    --color-spelling: #1e8449;      /* Green: orthographic changes (dark for white bg) */

    /* UI accent */
    --color-accent: #ffd700;        /* Gold: titles, active states */

    /* Dark theme backgrounds */
    --color-bg-dark: #1a1a2e;
    --color-bg-dark-end: #16213e;

    /* Mood header gradients */
    --color-indicative: #e67e22;
    --color-indicative-dark: #d35400;
    --color-subjunctive: #27ae60;
    --color-subjunctive-dark: #1e8449;
    --color-imperative: #e74c3c;
    --color-imperative-dark: #c0392b;

    /* Tense time colors (table headers) */
    --color-past-text: #c62828;
    --color-present-text: #2e7d32;
    --color-future-text: #1565c0;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--color-bg-dark) 0%, var(--color-bg-dark-end) 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header .verb-title {
    color: var(--color-accent);
    font-size: 1.8rem;
    font-style: italic;
}

/* Navigation */
.nav-container {
    position: relative;
    margin-bottom: 25px;
}

nav {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    padding-right: 0;
    border-radius: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

nav::-webkit-scrollbar {
    display: none;
}

.nav-scroll-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.4rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.nav-scroll-btn.left {
    left: 0;
    background: linear-gradient(to right, rgba(26,26,46,0.95) 0%, rgba(26,26,46,0.7) 50%, transparent 100%);
    padding-right: 10px;
    border-radius: 10px 0 0 10px;
}

.nav-scroll-btn.right {
    right: 0;
    background: linear-gradient(to left, rgba(26,26,46,0.95) 0%, rgba(26,26,46,0.7) 50%, transparent 100%);
    padding-left: 10px;
    border-radius: 0 10px 10px 0;
}

.nav-scroll-btn:hover {
    color: var(--color-accent);
}

.nav-scroll-btn.hidden {
    display: none;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
}

nav a {
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    transition: all 0.3s ease;
    white-space: nowrap;
}

nav a:hover, nav a.active {
    background: var(--color-accent);
    color: var(--color-bg-dark);
}

nav .nav-group {
    display: flex;
    gap: 5px;
    align-items: center;
    padding-right: 15px;
}

/* Bottom moods (subjunctive + imperative) side-by-side on wide screens */
@media (min-width: 900px) {
    .bottom-moods.compact {
        display: flex;
        gap: 30px;
        align-items: flex-start;
    }

    .bottom-moods.compact .mood-section {
        min-width: 0;
    }

    .bottom-moods.compact .subjunctive {
        flex: 3;
    }

    .bottom-moods.compact .imperative {
        flex: 2;
    }

    .bottom-moods.compact .conjugation-table {
        min-width: 0;
    }

}

.imperative-spacer {
    display: none;
}

@media (min-width: 900px) {
    .compact .imperative-spacer {
        display: table-row;
    }
}


/* Mood Sections */
.mood-section {
    margin-bottom: 30px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.mood-header {
    padding: 15px 20px;
    color: #fff;
    font-size: 1.3rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Indicative - Orange/Brown */
.indicative .mood-header {
    background: linear-gradient(135deg, var(--color-indicative), var(--color-indicative-dark));
}

/* Subjunctive - Green */
.subjunctive .mood-header {
    background: linear-gradient(135deg, var(--color-subjunctive), var(--color-subjunctive-dark));
}

/* Imperative - Red */
.imperative .mood-header {
    background: linear-gradient(135deg, var(--color-imperative), var(--color-imperative-dark));
}

/* Infinitive - Purple (unused, kept for potential future use) */

/* Conjugation Table with Sticky Column */
.table-wrapper {
    overflow-x: auto;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

.conjugation-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.conjugation-table th,
.conjugation-table td {
    padding: 8px 10px;
    text-align: center;
    border: 1px solid #e0e0e0;
    white-space: nowrap;
    font-size: 0.9rem;
}

/* Sticky first column */
.conjugation-table th:first-child,
.conjugation-table td:first-child {
    position: sticky;
    left: 0;
    background: #f8f9fa;
    z-index: 2;
    font-weight: 600;
    color: #555;
    font-style: italic;
    min-width: 90px;
    border-right: none;
}

/* Divider line that stays with frozen column */
.conjugation-table th:first-child::after,
.conjugation-table td:first-child::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #bbb;
}

/* Remove left border from second column to avoid gap */
.conjugation-table th:nth-child(2),
.conjugation-table td:nth-child(2) {
    border-left: none;
}

.conjugation-table thead th:first-child {
    background: #e9ecef;
    z-index: 3;
}

/* Header row */
.conjugation-table thead th {
    background: #f0f0f0;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #444;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Tense type colors in headers */
.conjugation-table th.past {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    color: var(--color-past-text);
}

.conjugation-table th.present {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: var(--color-present-text);
}

.conjugation-table th.future {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: var(--color-future-text);
}


.conjugation-table .stem {
    color: #666;
}

.conjugation-table .ending {
    color: var(--color-ending);
    font-weight: 600;
}

.conjugation-table .irregular {
    color: var(--color-irregular);
    font-weight: 600;
}

.conjugation-table .spelling {
    color: var(--color-spelling);
    font-weight: 600;
}

/* Alternating rows */
.conjugation-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.conjugation-table tbody tr:nth-child(even) th:first-child,
.conjugation-table tbody tr:nth-child(even) td:first-child {
    background: #f0f1f2;
}

.conjugation-table tbody tr:hover,
.conjugation-table tbody tr.row-highlight {
    background: #fff3e0;
}

.conjugation-table tbody tr:hover th:first-child,
.conjugation-table tbody tr:hover td:first-child,
.conjugation-table tbody tr.row-highlight th:first-child,
.conjugation-table tbody tr.row-highlight td:first-child {
    background: #ffe0b2;
}


/* Participles inline bar */
.participles-inline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.participles-inline.with-compound {
    grid-template-columns: repeat(5, 1fr);
}

.participle-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 2px 12px;
    padding: 8px 10px;
    border-right: 1px solid #e0e0e0;
}

.participle-cell:last-child {
    border-right: none;
}

.participle-label::after {
    content: ':';
}

.participle-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #444;
}

.participle-form {
    font-size: 0.9rem;
    color: #333;
}

.participle-form .irregular {
    color: var(--color-irregular);
    font-weight: 600;
}

.participle-form .spelling {
    color: var(--color-spelling);
    font-weight: 600;
}

.participle-form .ending {
    color: var(--color-ending);
    font-weight: 600;
}

.participle-form .alternate,
.participle-form .alternate .ending,
.participle-form .alternate .irregular {
    color: #666;
}

/* Irregularity note */
.irregularity-note {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.irregularity-note h4 {
    color: var(--color-accent);
    margin: 0;
    font-size: 0.9rem;
    white-space: nowrap;
}

.irregularity-note p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin: 0;
}

/* Verb input */
#verb-input {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

#verb-infinitive {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    width: 150px;
    background: rgba(255,255,255,0.9);
    font-family: inherit;
    text-align: center;
}

.ending-btn {
    padding: 10px 15px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.ending-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.ending-btn.active {
    background: var(--color-accent);
    color: var(--color-bg-dark);
    border-color: var(--color-accent);
}

/* Settings button */
.settings-btn {
    position: absolute;
    right: 0;
    padding: 10px 12px;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    background: transparent;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    line-height: 1;
}

.settings-btn:hover {
    color: rgba(255,255,255,0.8);
    border-color: rgba(255,255,255,0.3);
}

.settings-btn.active {
    color: var(--color-accent);
    border-color: rgba(255,215,0,0.4);
}

/* Settings panel */
.settings-panel {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    max-height: 80px;
    transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.settings-panel.hidden {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    opacity: 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.toggle-sub {
    padding-left: 20px;
    opacity: 0.5;
}

.toggle-sub.enabled {
    opacity: 1;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
}

footer a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
}

footer a:hover {
    color: rgba(255,255,255,0.8);
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    header .verb-title {
        font-size: 1.3rem;
    }

    #verb-infinitive {
        width: 100px;
    }

    .settings-btn {
        position: static;
    }

    .conjugation-table th,
    .conjugation-table td {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .conjugation-table th:first-child,
    .conjugation-table td:first-child {
        min-width: 70px;
    }
}
