/* ============================================================
   СБРОС
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: radial-gradient(ellipse at center, #0a0a2a 0%, #000 100%);
    color: #d4f0f5;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Мерцающий слой звёзд */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(1px 1px at 12% 15%, #fff, transparent),
        radial-gradient(2px 2px at 22% 55%, #fff, transparent),
        radial-gradient(1px 1px at 32% 25%, #fff, transparent),
        radial-gradient(2px 2px at 42% 75%, #fff, transparent),
        radial-gradient(1px 1px at 52% 5%, #fff, transparent),
        radial-gradient(2px 2px at 62% 45%, #fff, transparent),
        radial-gradient(1px 1px at 72% 85%, #fff, transparent),
        radial-gradient(2px 2px at 82% 35%, #fff, transparent),
        radial-gradient(1px 1px at 92% 65%, #fff, transparent),
        radial-gradient(2px 2px at 18% 40%, #fff, transparent),
        radial-gradient(1px 1px at 38% 50%, #fff, transparent),
        radial-gradient(2px 2px at 58% 30%, #fff, transparent),
        radial-gradient(1px 1px at 78% 60%, #fff, transparent),
        radial-gradient(2px 2px at 98% 20%, #fff, transparent),
        radial-gradient(1px 1px at 8% 80%, #fff, transparent),
        radial-gradient(2px 2px at 48% 90%, #fff, transparent);
    background-size: 200px 200px;
    opacity: 0.6;
    animation: twinkle 4s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

@keyframes twinkle {
    0% { opacity: 0.2; }
    50% { opacity: 0.9; }
    100% { opacity: 0.3; }
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   ШАПКА — СИНЯЯ ПАЛИТРА
   ============================================================ */

.header {
    background: rgba(15, 15, 31, 0.95);
    padding: 14px 0;
    border-bottom: 2px solid rgba(74, 108, 247, 0.25);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.logo i {
    color: #4a6cf7;
    font-size: 22px;
}

.logo span {
    color: #FFF8DC;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
    align-items: center;
}

.nav-menu > li > a,
.dropdown-trigger {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-menu > li > a:hover,
.dropdown-trigger:hover {
    color: #fff;
    background: rgba(74, 108, 247, 0.15);
}

.nav-menu > li > a.active {
    color: #fff;
    background: rgba(74, 108, 247, 0.2);
}

.dropdown-trigger i.fa-chevron-down {
    font-size: 10px;
    transition: transform 0.3s;
}

.nav-dropdown:hover .dropdown-trigger i.fa-chevron-down {
    transform: rotate(180deg);
}

.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    border-radius: 12px;
    min-width: 200px;
    padding: 8px;
    list-style: none;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.dropdown-menu a:hover {
    color: #fff;
    background: rgba(74, 108, 247, 0.15);
}

.dropdown-menu a i {
    color: #4a6cf7;
    font-size: 12px;
}

/* Устаревшие ссылки */
.dropdown-menu a.deprecated {
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

.dropdown-menu a.deprecated:hover {
    background: rgba(255, 0, 0, 0.08);
    color: rgba(255, 255, 255, 0.3);
}

.dropdown-menu a.deprecated i {
    color: rgba(255, 255, 255, 0.2);
}

.deprecated-badge {
    margin-left: auto;
    font-size: 9px;
    background: rgba(255, 0, 0, 0.8);
    color: #ff6b6b;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-divider-text {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: default;
    list-style: none;
}

.dropdown-divider-text::before,
.dropdown-divider-text::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.8);
}

.dropdown-divider-text i {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.15);
    margin-right: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    background: #4a6cf7;
    padding: 8px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-profile:hover {
    background: #3a5bd9;
}

/* ============================================================
   HERO / HERO-МАТЕРИАЛЫ
   ============================================================ */

.materials-hero {
    padding: 60px 0 40px;
    background: linear-gradient(135deg, rgba(15, 15, 31, 0.9) 0%, rgba(26, 26, 62, 0.9) 100%);
    border-bottom: 1px solid rgba(74, 108, 247, 0.1);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(5px);
}

.materials-hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.materials-hero-text {
    flex: 1;
}

.materials-hero-text h1 {
    font-size: 42px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 12px;
}

.materials-hero-text h1 span {
    color: #4a6cf7;
}

.materials-hero-text p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    max-width: 500px;
}

.materials-hero-icon {
    font-size: 80px;
}

.materials-hero-icon i {
    color: #4a6cf7;
    opacity: 0.3;
}

.materials-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(74, 108, 247, 0.15);
    color: #4a6cf7;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
}

.hero-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    display: block;
}

/* ============================================================
   СЕКЦИЯ МАТЕРИАЛОВ
   ============================================================ */

.materials-section {
    padding: 40px 0 60px;
    position: relative;
    z-index: 1;
}

.materials-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(74, 108, 247, 0.08);
}

.filters-left {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filters-right {
    display: flex;
    gap: 8px;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 2px solid rgba(74, 108, 247, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.filter-btn:hover {
    border-color: #4a6cf7;
    color: #b0b8ff;
}

.filter-btn.active {
    background: #4a6cf7;
    border-color: #4a6cf7;
    color: #fff;
}

.materials-count {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
    display: flex;
    align-items: center;
}

.materials-empty {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(5px);
    border-radius: 14px;
    border: 2px dashed rgba(74, 108, 247, 0.15);
}

.materials-empty i {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 16px;
}

.materials-empty h3 {
    font-size: 20px;
    color: #FFF8DC;
    margin-bottom: 8px;
}

.materials-empty p {
    color: rgba(255, 255, 255, 0.4);
}

/* ============================================================
   ФОРМЫ
   ============================================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #FFF8DC;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(74, 108, 247, 0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus,
textarea:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.15);
}

.form-group input[type="number"] {
    color-scheme: dark;
}

textarea {
    resize: vertical;
    min-height: 90px;
}

.form-group select {
    padding-right: 40px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1 L6 6 L11 1' stroke='%234a6cf7' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.form-group select option {
    background: #1a1a2e;
    color: #fff;
}

input[type="file"] {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px dashed rgba(74, 108, 247, 0.3);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    background: #4a6cf7;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 12px;
    font-family: inherit;
}

input[type="file"]::file-selector-button:hover {
    background: #3a5bd9;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.form-hint a {
    color: #4a6cf7;
    text-decoration: none;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ============================================================
   КНОПКИ
   ============================================================ */

.btn-cancel,
.btn-save,
.btn-delete-confirm {
    padding: 10px 22px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #4a6cf7;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-download:hover {
    background: #3a5bd9;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 108, 247, 0.3);
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
}

.btn-save {
    background: #4a6cf7;
    color: #fff;
}

.btn-save:hover {
    background: #3a5bd9;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 108, 247, 0.3);
}

.btn-delete-confirm {
    background: #ff6b6b;
    color: #fff;
}

.btn-delete-confirm:hover {
    background: #e85555;
    transform: translateY(-2px);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #FFF8DC;
    font-size: 14px;
    font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4a6cf7;
    cursor: pointer;
}

.icon-preview {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80px;
    height: 80px;
    margin-left: auto;
    margin-right: auto;
    border-radius: 16px;
    background: rgba(74, 108, 247, 0.08);
    border: 1px dashed rgba(74, 108, 247, 0.3);
}

.icon-preview i {
    font-size: 36px;
    color: #4a6cf7;
}

.file-current {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 14px;
    background: rgba(74, 108, 247, 0.08);
    border-radius: 8px;
    font-size: 13px;
    color: #FFF8DC;
}

.file-current i {
    color: #4a6cf7;
}

/* ============================================================
   АДАПТИВ
   ============================================================ */

@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .nav-menu {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
        width: 100%;
    }

    .nav-menu > li > a,
    .dropdown-trigger {
        padding: 6px 12px;
        font-size: 13px;
    }

    .materials-hero-content {
        flex-direction: column;
        text-align: center;
    }

    .materials-hero-text p {
        max-width: 100%;
    }

    .materials-hero-text h1 {
        font-size: 28px;
    }

    .materials-hero-icon {
        font-size: 50px;
    }

    .materials-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-left {
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .hero-logo {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 500px) {
    .materials-hero-text h1 {
        font-size: 22px;
    }

    .dropdown-menu {
        position: static;
        transform: none;
        background: rgba(26, 26, 46, 0.95);
        box-shadow: none;
        border: none;
    }

    .dropdown-menu a {
        padding-left: 30px;
    }

    .hero-logo {
        width: 60px;
        height: 60px;
    }
}