:root {
    --sky: #6fc7f1;
    --sky-dark: #45b3e7;
    --navy: #0f1b2b;
    --navy-deep: #09111b;
    --navy-soft: #13253a;
    --white: #ffffff;
    --text: #eaf7ff;
    --text-soft: #b8d6e6;
    --border: rgba(111, 199, 241, 0.18);
    --border-strong: rgba(111, 199, 241, 0.4);
    --card: rgba(255, 255, 255, 0.04);
    --card-strong: rgba(255, 255, 255, 0.07);
    --success: #4dc97a;
    --danger: #ff6b6b;
    --warning: #f5c451;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    --radius: 18px;
    --radius-sm: 12px;
    --max: 1180px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        linear-gradient(rgba(9, 17, 27, 0.9), rgba(9, 17, 27, 0.97)),
        radial-gradient(circle at top, rgba(111, 199, 241, 0.12), transparent 42%);
    background-color: var(--navy-deep);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: var(--sky);
    text-decoration: none;
    transition: color 0.18s ease, opacity 0.18s ease;
}

a:hover {
    color: #9adfff;
}

img,
video,
iframe {
    max-width: 100%;
    display: block;
    border-radius: var(--radius-sm);
}

button,
.btn {
    appearance: none;
    border: none;
    outline: none;
    border-radius: 999px;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--sky), var(--sky-dark));
    color: var(--navy-deep);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease, background 0.18s ease;
    box-shadow: 0 10px 24px rgba(69, 179, 231, 0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    opacity: 0.97;
    color: var(--navy-deep);
}

button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn.secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-strong);
    box-shadow: none;
}

.btn.secondary:hover {
    color: var(--white);
    border-color: rgba(111, 199, 241, 0.7);
    background: rgba(111, 199, 241, 0.08);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input::placeholder,
textarea::placeholder {
    color: rgba(184, 214, 230, 0.68);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(111, 199, 241, 0.14);
    background: rgba(255, 255, 255, 0.055);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 13px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    vertical-align: top;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

th {
    color: #bfe9ff;
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    color: var(--white);
    line-height: 1.15;
}

p {
    color: var(--text-soft);
    line-height: 1.6;
}

.small {
    font-size: 0.92rem;
    color: var(--text-soft);
}

.container {
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(9, 17, 27, 0.86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.topbar-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--white);
    font-weight: 800;
}

.brand img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 50%;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-text strong {
    color: var(--white);
    line-height: 1.1;
}

.brand-text span {
    color: var(--text-soft);
    font-size: 0.88rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-links a,
.nav-links .btn {
    font-size: 0.95rem;
}

.page-hero {
    padding: 36px 0 20px;
}

.page-hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 10px;
}

.page-hero p {
    max-width: 760px;
}

.card,
.panel,
.auth-card,
.dashboard-card,
.quiz-card,
.module-card,
.slide-card,
.table-card,
.form-card,
.stat-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card,
.panel,
.dashboard-card,
.quiz-card,
.module-card,
.slide-card,
.table-card,
.form-card {
    padding: 24px;
}

.auth-wrap {
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 16px;
}

.auth-card {
    width: min(520px, 100%);
    padding: 32px;
}

.auth-card h1,
.auth-card h2 {
    margin-bottom: 12px;
}

.auth-card p {
    margin-bottom: 24px;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

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

.stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.flash {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    background: rgba(111, 199, 241, 0.08);
    color: var(--text);
}

.flash.success {
    border-color: rgba(77, 201, 122, 0.45);
    background: rgba(77, 201, 122, 0.12);
}

.flash.error {
    border-color: rgba(255, 107, 107, 0.45);
    background: rgba(255, 107, 107, 0.12);
}

.flash.warning {
    border-color: rgba(245, 196, 81, 0.45);
    background: rgba(245, 196, 81, 0.12);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.stat-card {
    padding: 22px;
}

.stat-card .label {
    font-size: 0.9rem;
    color: var(--text-soft);
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.02em;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--sky), var(--sky-dark));
}

.progress-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-inline strong {
    min-width: 54px;
    text-align: right;
}

.module-list,
.slide-list,
.quiz-list,
.user-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.module-item,
.slide-item,
.quiz-item,
.user-item {
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.module-item.locked {
    opacity: 0.7;
}

.module-item.complete {
    border-color: rgba(77, 201, 122, 0.45);
}

.module-item h3,
.slide-item h3,
.quiz-item h3,
.user-item h3 {
    margin-bottom: 8px;
}

.badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
    border: 1px solid var(--border);
    background: rgba(111, 199, 241, 0.08);
    color: #d8f2ff;
}

.badge.success {
    border-color: rgba(77, 201, 122, 0.45);
    background: rgba(77, 201, 122, 0.12);
}

.badge.warning {
    border-color: rgba(245, 196, 81, 0.45);
    background: rgba(245, 196, 81, 0.12);
    color: #fff0c4;
}

.badge.danger {
    border-color: rgba(255, 107, 107, 0.45);
    background: rgba(255, 107, 107, 0.12);
}

.slide-stage {
    display: grid;
    gap: 22px;
}

.slide-media {
    display: block;
    width: 100%;
    margin: 22px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    min-height: 0;
    max-height: none;
    overflow: visible;
    text-align: center;
    box-shadow: none;
}

.slide-media img {
    display: block;
    margin: 0 auto;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: none;
}

.slide-media video {
    display: block;
    margin: 0 auto;
    width: min(100%, 900px);
    height: auto;
    border-radius: 12px;
    box-shadow: none;
}

.slide-media iframe {
    display: block;
    margin: 0 auto;
    width: min(100%, 900px);
    aspect-ratio: 16 / 9;
    min-height: 320px;
    border: 0;
    border-radius: 12px;
    background: transparent;
}

.slide-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.slide-nav .left,
.slide-nav .right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.checklist-item input[type="checkbox"] {
    width: auto;
    margin-top: 2px;
}

.quiz-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.question,
.quiz-question-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
}

.question h4,
.quiz-question-card h3 {
    margin-bottom: 16px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.quiz-answer-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(111, 199, 241, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.quiz-answer-row:hover {
    border-color: rgba(111, 199, 241, 0.45);
    background: rgba(111, 199, 241, 0.06);
    transform: translateY(-1px);
}

.quiz-answer-row input[type="radio"] {
    width: auto;
    margin: 0;
    flex: 0 0 auto;
}

.quiz-answer-row span {
    display: block;
    flex: 1;
    text-align: left;
    line-height: 1.45;
    color: var(--text);
}

.quiz-result {
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.quiz-result.passed {
    border-color: rgba(77, 201, 122, 0.45);
    background: rgba(77, 201, 122, 0.1);
}

.quiz-result.failed {
    border-color: rgba(255, 107, 107, 0.45);
    background: rgba(255, 107, 107, 0.1);
}

.review-card {
    padding: 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.review-card.correct {
    border-color: rgba(77, 201, 122, 0.35);
}

.review-card.incorrect {
    border-color: rgba(255, 107, 107, 0.35);
}

.small-note {
    padding: 16px 20px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

.empty-state {
    padding: 26px;
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
    text-align: center;
    color: var(--text-soft);
    background: rgba(255, 255, 255, 0.02);
}

.table-wrap {
    overflow-x: auto;
    border-radius: 14px;
}

.table-wrap table {
    min-width: 700px;
}

.admin-tabs-card {
    padding: 18px;
}

.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.admin-tab-button {
    background: rgba(255, 255, 255, 0.04);
    color: #eaf7ff;
    border: 1px solid rgba(111, 199, 241, 0.18);
    border-radius: 999px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: none;
}

.admin-tab-button:hover {
    background: rgba(111, 199, 241, 0.08);
    color: #ffffff;
    transform: translateY(-1px);
}

.admin-tab-button.active {
    background: linear-gradient(135deg, #6fc7f1, #45b3e7);
    color: #09111b;
    border-color: transparent;
}

.admin-tab-panel {
    display: none;
}

.admin-tab-panel.active {
    display: block;
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    color: #6fc7f1;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
    box-shadow: none;
}

.link-button:hover {
    opacity: 0.85;
    transform: none;
    color: #9adfff;
}

.footer {
    padding: 30px 0 40px;
    color: var(--text-soft);
}

.slide-card,
.module-stage,
.card {
    overflow: visible;
}

@media (max-width: 1024px) {
    .stat-grid,
    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .topbar {
        position: static;
        top: auto;
    }

    .topbar-inner {
        min-height: auto;
        padding: 14px 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .nav-links {
        width: 100%;
    }

    .nav-links a,
    .nav-links .btn {
        width: 100%;
        justify-content: center;
    }

    .grid-2,
    .grid-3,
    .form-grid,
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .slide-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .slide-nav .left,
    .slide-nav .right {
        width: 100%;
    }

    .slide-nav .left > *,
    .slide-nav .right > * {
        flex: 1 1 auto;
    }

    .slide-media {
        margin-top: 18px;
        padding: 0;
        background: transparent;
        overflow: visible;
    }

    .slide-media img,
    .slide-media video {
        max-width: 100%;
        height: auto;
    }

    .slide-media iframe {
        width: 100%;
        min-height: 220px;
        background: transparent;
    }

    .quiz-answer-row {
        align-items: flex-start;
    }

    .admin-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .admin-tab-button {
        width: 100%;
        justify-content: center;
    }

    th,
    td {
        padding: 10px 10px;
        font-size: 0.95rem;
    }

    .card,
    .panel,
    .dashboard-card,
    .quiz-card,
    .module-card,
    .slide-card,
    .table-card,
    .form-card,
    .auth-card {
        padding: 18px;
    }

    .table-wrap table {
        min-width: 620px;
    }
}

@media (max-width: 520px) {
    .container {
        width: min(var(--max), calc(100% - 20px));
    }

    .admin-tabs {
        grid-template-columns: 1fr;
    }

    .page-hero h1 {
        font-size: 1.85rem;
    }

    .stat-card .value {
        font-size: 1.6rem;
    }

    .slide-media img,
    .slide-media video {
        max-height: none;
    }

    .slide-media iframe {
        min-height: 200px;
    }
}