/* Grammar Page Styles */

.grammar-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    position: sticky;
    top: 70px;
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    padding: 0;
}

/* Level Switch */
.grammar-level-switch {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.grammar-level-btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-xs);
    cursor: pointer;
}

.grammar-level-btn:hover {
    color: var(--color-text);
}

.grammar-level-btn.active {
    background: var(--color-bg);
    color: var(--color-accent);
    box-shadow: 0 1px 3px var(--color-shadow-light);
}

.grammar-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.grammar-nav-item {
    padding: 5px 10px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-sm);
    line-height: 1.3;
}

.grammar-nav-item:hover {
    background: var(--color-bg-secondary);
    color: var(--color-text);
}

.grammar-nav-item.active {
    background: var(--color-bg-secondary);
    color: var(--color-text);
    font-weight: var(--font-weight-semibold);
}

.grammar-content {
    flex: 1;
    padding: 0 2rem 2rem 0;
    max-width: 800px;
}

.grammar-section {
    margin-bottom: 4rem;
    padding-top: 1rem;
}

.grammar-section h2 {
    color: var(--color-text);
    font-size: var(--font-size-4xl);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-border);
}

.grammar-section h3 {
    color: var(--color-text);
    font-size: var(--font-size-2xl);
    margin: 2rem 0 1rem;
}

.grammar-section p {
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* Tables */
.grammar-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.5rem;
    background: var(--color-bg);
    box-shadow: 0 1px 3px var(--color-shadow-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

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

.grammar-table th {
    background: var(--color-bg-secondary);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
}

.grammar-table tr:last-child td {
    border-bottom: none;
}

.grammar-table.conjugation {
    max-width: 300px;
}

.grammar-table.conjugation td:first-child {
    color: var(--color-text-tertiary);
    width: 120px;
}

.grammar-table.comparison th {
    width: 50%;
}

.grammar-table em {
    color: var(--color-text-tertiary);
    font-size: 0.9em;
}

/* Examples */
.examples {
    background: var(--color-bg-secondary);
    border-left: 4px solid var(--color-accent);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.examples p {
    margin: 0.5rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.examples .es {
    color: var(--color-accent);
    font-weight: var(--font-weight-medium);
}

.examples .ru {
    color: var(--color-text-tertiary);
}

.examples .ru::before {
    content: "— ";
}

/* Rules list */
.rules {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.rules li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.rules li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
}

/* Notes */
.note {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

[data-theme="dark"] .note {
    background: #422006;
    border-color: #854d0e;
}

.note p {
    margin: 0.3rem 0;
    color: #92400e;
    font-size: var(--font-size-base);
}

[data-theme="dark"] .note p {
    color: #fbbf24;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .note {
        background: #422006;
        border-color: #854d0e;
    }
    :root:not([data-theme="light"]) .note p {
        color: #fbbf24;
    }
}

/* Verb list */
.verb-list {
    column-count: 2;
    column-gap: 2rem;
    margin: 1rem 0;
}

.verb-list p {
    margin: 0.4rem 0;
    break-inside: avoid;
}

/* Mobile styles */
@media (max-width: 768px) {
    .grammar-sidebar {
        width: 100%;
        max-height: 50dvh;
        position: sticky;
        top: 50px;
        z-index: 10;
        background: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
    }

    .grammar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .grammar-nav-item {
        padding: 0.4rem 0.8rem;
        border-radius: 20px;
        font-size: var(--font-size-xs);
        background: var(--color-bg-secondary);
        margin: 0;
    }

    .grammar-nav-item:hover {
        background: var(--color-bg-hover);
    }

    .grammar-nav-item.active {
        background: var(--color-accent);
        color: white;
    }

    .grammar-content {
        padding: 1rem;
        max-width: 100%;
    }

    .grammar-section h2 {
        font-size: 1.4rem;
    }

    .grammar-table {
        font-size: var(--font-size-sm);
    }

    .grammar-table th,
    .grammar-table td {
        padding: 0.5rem;
    }

    .verb-list {
        column-count: 1;
    }

    .examples p {
        flex-direction: column;
        gap: 0.2rem;
    }

    .examples .ru::before {
        content: "";
    }
}

/* Scrollbar styling */
.grammar-sidebar::-webkit-scrollbar {
    width: var(--scrollbar-width);
}

.grammar-sidebar::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.grammar-sidebar::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--space-xs);
}

.grammar-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
