﻿:root {
    color-scheme: light dark;
}

/* === Layout === */
body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 650px;
    width: 100%;
    padding: 1rem;
    margin: 0 auto;
    box-sizing: border-box;
}

h1, h2, h3 {
    text-align: center;
}

.heading-spacing {
    margin: 40px 0;
}

/* === Utility classes === */
.mb-2 {
    margin-bottom: 20px;
}

.mt-4 {
    margin-top: 40px;
}

.inline-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .inline-row input {
        transform: translateY(-5px);
    }

.hidden {
    display: none !important;
}

/* === Header + Burger === */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #333;
    color: white;
    padding: 1rem;
}

.header-left {
    position: relative; /* 💡 Обязательно! Меню позиционируется относительно этой области */
}

.burger-button {
    font-size: 2rem;
    background: none;
    color: white;
    border: none;
    cursor: pointer;
}

.side-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    background: #444;
    color: white;
    padding: 0.25rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: 0.3s ease;
    z-index: 10;
}

    .side-menu.open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .side-menu ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .side-menu li {
        margin: 0;
        padding: 0;
    }

    .side-menu button {
        width: 100%;
        background: none;
        border: none;
        color: white;
        font-size: 1rem;
        text-align: left;
        margin:0;
        padding: 5px;
        cursor: pointer;
    }

/* === Overlay === */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: 0.3s ease;
    z-index: 5;
}

    .overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

/* === Forms === */
label {
    display: block;
    margin-bottom: 10px;
}

input:not([type="checkbox"]),
select {
    font-size: 1rem;
    padding: 5px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* === Buttons === */
button {
    all: unset;
    display: inline-block;
    background: #007bff;
    color: white;
    border-radius: 5px;
    padding: 10px;
    margin: 10px 0;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

    button:hover {
        background: #0056b3;
    }

.delete-button {
    color: red;
    background: none;
    font-size: 1rem;
    padding: 0;
    width: auto;
}

/* === Tables === */
#wordTable {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    margin-top: 1rem;
}

    #wordTable th,
    #wordTable td {
        border: 1px solid #ccc;
        padding: 0.3rem;
        vertical-align: middle;
        white-space: normal;
        word-wrap: break-word;
    }

    #wordTable th {
        background: #f9f9f9;
        position: sticky;
        top: 0;
        text-align: center;
        height: 40px;
        z-index: 1;
    }

    #wordTable tbody {
        display: block;
        max-height: 300px;
        overflow-y: auto;
        width: 100%;
    }

        #wordTable thead,
        #wordTable tbody tr {
            display: table;
            width: 100%;
            table-layout: fixed;
        }

    #wordTable th:first-child,
    #wordTable td:first-child {
        width: 20px;
        text-align: center;
    }

    #wordTable th:last-child,
    #wordTable td:last-child {
        width: 65px;
        text-align: center;
    }

.editable-cell:focus {
    outline: 2px solid #007bff;
    background: #eef5ff;
}

/* === Menu and Layouts === */
.menu {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
    margin-top: 1rem;
    justify-content: space-between;
}

    .menu button {
        width: auto;
        flex: 1;
    }

.language-panel {
    display: flex;
    justify-content: center;
    width: 100%;
    gap: 2rem;
}

.language-panel-column {
    display: block;
}

/* === Repeat panel === */

.check-result {
    margin: 0;
    padding: 0;
    min-height: 2.5em;
}

/* === Grammar Red line === */

#grammar-div p {
    text-indent: 2em; /* можно 20px, 1.5rem и т.п. */
}

/* === Loader === */
.loader {
    text-align: center;
    margin: 20px;
}

.spinner {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* === Responsive === */
@media (max-width: 650px) {
    .container {
        padding: 0.5rem;
    }

    .menu {
        flex-direction: column;
        gap: 0;
    }
    .menu button {
        margin: 5px;
    }
}

@media (prefers-color-scheme: dark) {
    #wordTable th {
        background: #2a2a2a;
        color: #fff;
    }

    .editable-cell:focus {
        background: #2d3b55;
        color: #fff;
    }
}
