@import url("site-chrome.css");

/* ===== Сброс и основа ===== */

*, *::before, *::after { box-sizing: border-box; }


/* ===== Фон ===== */

.bg-media {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    z-index: 0;
}

.bg-static { z-index: 0; }

.bg-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}


/* ===== Шапка ===== */

.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

nav ul li a:hover { color: #fff; }
nav ul li a.logout-link { opacity: 0.5; }
nav ul li a.logout-link:hover { opacity: 0.8; }

.nav-controls {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

.nav-controls a {
    display: inline-flex;
    align-items: center;
    padding: 0;
    background: transparent;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
}

.nav-controls a:hover { opacity: 1; transform: scale(1.1); }


/* ===== Основной контент ===== */

main {
    padding: 20px;
    flex: 1;
    position: relative;
    z-index: 2;
}

#main-content {
    min-height: 320px;
}

.page-loading-shell {
    padding: 20px 0;
    display: grid;
    gap: 12px;
}

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

.page-loading-card {
    position: relative;
    overflow: hidden;
    min-height: 104px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(12, 12, 12, 0.56);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.page-loading-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transform: translateX(-100%);
    animation: page-loading-shimmer 1.2s ease-in-out infinite;
}

.page-loading-card-lg {
    min-height: 160px;
}

.page-loading-card-sm {
    min-height: 56px;
}

@keyframes page-loading-shimmer {
    to {
        transform: translateX(100%);
    }
}


/* ===== Футер ===== */

header,
footer {
    position: relative;
    z-index: 2;
}


/* ===== Медиа в постах ===== */

.post { margin-bottom: 30px; }

.post h2 {
    font-weight: 400;
    font-size: 20px;
    margin-bottom: 8px;
}

.post small { color: rgba(255, 255, 255, 0.4); }

.post-media {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
    border-radius: 6px;
}

@media (min-width: 992px) {
    .post-media { max-width: 60%; }
}

.audio-container { margin: 10px 0; }

audio {
    width: 100%;
    max-width: 600px;
    display: block;
    margin: 0 auto;
}


/* ===== Кнопки ===== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}
.btn-primary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.85);
}

.btn-danger {
    background: rgba(255, 80, 80, 0.1);
    border-color: rgba(255, 80, 80, 0.25);
    color: rgba(255, 140, 140, 0.9);
}
.btn-danger:hover {
    background: rgba(255, 80, 80, 0.2);
    border-color: rgba(255, 80, 80, 0.4);
    color: #ff9999;
}

.btn-success {
    background: rgba(80, 200, 80, 0.1);
    border-color: rgba(80, 200, 80, 0.25);
    color: rgba(140, 230, 140, 0.9);
}
.btn-success:hover {
    background: rgba(80, 200, 80, 0.2);
    border-color: rgba(80, 200, 80, 0.4);
    color: #99ee99;
}

.btn-sm { padding: 6px 10px; font-size: 12px; }


/* ===== Формы ===== */

.auth-form {
    max-width: 350px;
}

.auth-form label {
    display: block;
    margin-bottom: 5px;
    margin-top: 14px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="url"],
.auth-form input[type="email"],
.auth-form textarea,
.auth-form select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s, background 0.2s;
}

.auth-form input:focus,
.auth-form textarea:focus,
.auth-form select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
}

.auth-form input::placeholder,
.auth-form textarea::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.auth-form button[type="submit"],
.auth-form .btn {
    margin-top: 18px;
}

.auth-form small {
    display: block;
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    margin-top: 4px;
}


/* ===== Сообщения ===== */

.form-message { margin: 10px 0; font-size: 14px; }

.form-message.error,
.error { color: #ff8080; }

.form-message.success,
.success { color: #80e080; }

.warning-box {
    background: rgba(255, 200, 50, 0.08);
    border: 1px solid rgba(255, 200, 50, 0.2);
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    color: rgba(255, 220, 100, 0.9);
    font-size: 14px;
}


/* ===== Таблицы (admin) ===== */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 14px;
}

.admin-table th {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
}
.admin-table a:hover { color: #fff; }

.admin-section { margin-bottom: 30px; }

.admin-section h3 {
    font-weight: 400;
    font-size: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
}

.admin-section textarea {
    width: 100%;
    max-width: 500px;
    min-height: 100px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
}

.admin-section textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
}

.admin-section input[type="text"],
.admin-section input[type="file"] {
    display: block;
    margin: 8px 0;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s;
}

.admin-section input[type="text"]:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.4);
}

.admin-section label {
    display: block;
    margin: 8px 0 4px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}


/* ===== Скроллбар ===== */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.35); }

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}


/* ===== Прогресс-бар ===== */

.progress-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    height: 16px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
}


/* ===== Модальное окно ===== */

body.modal-open { overflow: hidden; }


/* ===== Чекбоксы ===== */

input[type="checkbox"] {
    accent-color: rgba(255, 255, 255, 0.6);
}

.file-upload-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-upload-btn {
    cursor: pointer;
    display: inline-flex;
    flex-shrink: 0;
}

.file-upload-name {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    overflow-wrap: anywhere;
}

.switch-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px 0;
}

.switch-field input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-control {
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}

.switch-control::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    transition: transform 0.2s, background 0.2s;
}

.switch-field input:checked + .switch-control {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.32);
}

.switch-field input:checked + .switch-control::after {
    transform: translateX(20px);
    background: #fff;
}

.switch-field input:focus-visible + .switch-control {
    outline: 2px solid rgba(255, 255, 255, 0.35);
    outline-offset: 2px;
}

.switch-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.switch-title {
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
}

.switch-description {
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
    line-height: 1.4;
}


/* ===== Адаптивность ===== */

@media (max-width: 768px) {
    .hamburger { display: block; }

    nav ul { display: none; }

    nav ul.collapsed {
        display: flex;
        flex-direction: column;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        position: fixed;
        top: var(--site-chrome-height);
        left: 50%;
        transform: translateX(-50%);
        width: 70%;
        max-width: 280px;
        z-index: 99;
        padding: 16px 20px;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        gap: 10px;
    }

    .nav-controls {
        margin-left: 0;
        justify-content: center;
    }

    main { padding: 10px; margin-bottom: var(--site-chrome-height); }

    .page-loading-shell {
        padding: 10px 0;
    }

    .page-loading-grid {
        grid-template-columns: 1fr;
    }

    footer {
        font-size: 12px;
        position: fixed;
        bottom: 0;
        width: 100%;
    }
}

@media (max-width: 480px) {
    main { padding: 8px; margin-bottom: var(--site-chrome-height); }
    .auth-form { max-width: 100%; }
}
