:root {
    --primary: #0077b6;
    --primary-dark: #005f92;
    --background: #f4f7f9;
    --surface: #ffffff;
    --text: #333333;
    --muted: #666666;
    --border: #dddddd;
    --danger: #b42318;
    --success: #067647;
    --info: #155eef;
    --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 12px 30px rgba(0, 0, 0, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
}

button,
input,
textarea {
    font: inherit;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
    clip: rect(0, 0, 0, 0);
}

.hidden-section {
    display: none;
}

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


/* СТРАНИЦА АВТОРИЗАЦИИ    */


.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(0, 119, 182, 0.12), transparent 25%),
        radial-gradient(circle at bottom right, rgba(106, 164, 252, 0.18), transparent 30%),
        var(--background);
}

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 560px;
    padding: 32px;
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow-medium);
}

.auth-brand h1 {
    margin-bottom: 8px;
    color: var(--primary);
}

.auth-brand p {
    margin-bottom: 24px;
    color: var(--muted);
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form label {
    display: grid;
    gap: 8px;
}

.auth-form span {
    font-weight: bold;
}

.auth-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.12);
}

.primary-btn {
    padding: 14px 18px;
    border: none;
    border-radius: 14px;
    background: var(--primary);
    color: #ffffff;
    font-weight: bold;
    cursor: pointer;
}

.primary-btn:hover {
    background: var(--primary-dark);
}

.auth-note {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.auth-note ol {
    margin: 12px 0 0 22px;
    padding: 0;
    line-height: 1.7;
}

.auth-note-small {
    margin-top: 16px;
    color: var(--muted);
    font-size: 14px;
}

.message-box {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    line-height: 1.5;
}

.message-box--error {
    background: #fef3f2;
    color: var(--danger);
}

.message-box--success {
    background: #ecfdf3;
    color: var(--success);
}

.message-box--info {
    background: #eef4ff;
    color: var(--info);
}

/* -------------------------------------------------- */
/* ШАПКА                                               */
/* -------------------------------------------------- */

.site-header {
    background: var(--surface);
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
}

.top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.site-title {
    margin: 0;
    color: var(--primary);
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f7fbfd;
    border: 1px solid #dcebf4;
    border-radius: 16px;
}

.user-panel__text {
    display: flex;
    flex-direction: column;
    text-align: right;
    gap: 2px;
}

.user-panel__text span {
    color: var(--muted);
    font-size: 14px;
}

.logout-link {
    padding: 10px 14px;
    border-radius: 12px;
    background: #fef3f2;
    color: var(--danger);
    text-decoration: none;
    font-weight: bold;
}

.mode-switcher {
    display: inline-flex;
    margin-bottom: 20px;
    padding: 5px;
    background: #eeeeee;
    border-radius: 30px;
}

.mode-btn {
    padding: 10px 30px;
    border: none;
    border-radius: 25px;
    background: transparent;
    color: var(--muted);
    font-weight: bold;
    cursor: pointer;
}

.mode-btn.active {
    background: var(--primary);
    color: #ffffff;
}

.search-wrapper input {
    display: block;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 25px;
    outline: none;
    font-size: 16px;
}


/* ФИЛЬТРЫ               */


.filters {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.filter-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    cursor: pointer;
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.filters::-webkit-scrollbar {
    display: block;
    height: 6px;
}

.filters::-webkit-scrollbar-track {
    background: transparent;
}

.filters::-webkit-scrollbar-thumb {
    background: #cccccc;
    border-radius: 10px;
}

.filters::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* -------------------------------------------------- */
/* ВИДЕО                                               */
/* -------------------------------------------------- */

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

.card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
}

.video-box {
    position: relative;
    padding-bottom: 56.25%;
    background: #000000;
}

.video-box iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 15px;
}

.card-title {
    margin: 0 0 10px;
    font-size: 18px;
}

.card-description {
    margin: 0 0 16px;
    line-height: 1.5;
    color: #444444;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.tag {
    padding: 4px 8px;
    border-radius: 4px;
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.2s;
}

.tag:hover {
    opacity: 0.8;
}

.card-bottom {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: space-between;
    width: 100%;
    margin-top: auto;
}

.watch-btn {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--primary);
    border-radius: 5px;
    background: transparent;
    color: var(--primary);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.watch-btn:hover {
    background: #eef6ff;
}

.watch-btn.watched {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.watch-btn.watched:hover {
    background: #c3e6cb;
}

.fav-btn {
    padding: 0 5px;
    border: none;
    background: transparent;
    color: #cccccc;
    font-size: 26px;
    cursor: pointer;
    transition: transform 0.2s;
}

.fav-btn:hover {
    transform: scale(1.1);
}

.fav-btn.active {
    color: red;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 30px;
    text-align: center;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
}

.load-more-container {
    margin: 30px 0;
    text-align: center;
}

.load-more-btn {
    display: none;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
    font-size: 16px;
}

.load-more-btn:hover {
    background: var(--primary-dark);
}

/* КУРСЫ             */

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.course-card {
    display: flex;
    overflow: hidden;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-medium);
    cursor: pointer;
    transition: transform 0.2s;
}

.course-card:hover {
    transform: translateY(-5px);
}

.course-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    color: #ffffff;
    font-weight: bold;
    text-align: center;
    padding: 12px;
}

.course-cover--red {
    background: #e63946;
}

.course-cover--blue {
    background: #6AA4FC;
}

.course-info {
    flex: 1;
    padding: 20px;
}

.start-course-btn {
    margin-top: 10px;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    background: var(--primary);
    color: #ffffff;
    cursor: pointer;
}

/* -------------------------------------------------- */
/* АДАПТАЦИЯ                                           */
/* -------------------------------------------------- */

@media (max-width: 860px) {
    .top-row {
        flex-direction: column;
        align-items: stretch;
    }

    .user-panel {
        justify-content: space-between;
    }

    .user-panel__text {
        text-align: left;
    }
}

@media (max-width: 600px) {
    .auth-card {
        padding: 22px;
        border-radius: 18px;
    }

    .search-wrapper {
        padding: 0 15px;
    }

    .search-wrapper input {
        width: 100%;
    }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .filter-btn {
        padding: 10px 20px;
    }

    .courses-grid {
        grid-template-columns: 1fr;
    }

    .course-card {
        flex-direction: column;
    }

    .course-cover {
        width: 100%;
        min-height: 80px;
    }
}
