/* ==========================================================================
   1. ГЛОБАЛЬНЫЕ НАСТРОЙКИ (СВЕТЛАЯ БЕЛО-ЖЕЛТАЯ ТЕМА)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f4f5f6; /* Мягкий светлый фон сайта */
    color: #0f172a;           /* Глубокий темный цвет для текста */
    font-family: system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

/* ==========================================================================
   2. ШАПКА САЙТА (HEADER)
   ========================================================================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background-color: #ffffff; /* Идеально белый фон шапки */
    border-bottom: 1px solid #e2e8f0; /* Тонкая светлая полоса */
}

header .nav-actions {
    display: flex;
    align-items: center;
    gap: 16px; /* Отступ между кнопкой загрузки и аватаркой */
}

/* Стили для текстового логотипа */
.logo {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
    color: #0f172a;
}

.logo span {
    color: #0f172a;
    background-color: #fde047; /* Желтый фон для выделения букв UN */
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 2px;
}

/* Стили для квадратного логотипа-картинки (если решишь переключить) */
.logo-link {
    display: block;
}

.logo-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

/* ==========================================================================
   3. КНОПКИ (BUTTONS)
   ========================================================================== */
.btn {
    background-color: #fde047; /* Пастельно-желтый цвет */
    color: #0f172a;           /* Темный текст на кнопке */
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.btn:hover {
    background-color: #facc15; /* Чуть более насыщенный желтый при наведении */
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: #e2e8f0; /* Светло-серый для второстепенных кнопок */
    color: #475569;
}

.btn-secondary:hover {
    background-color: #cbd5e1;
    color: #0f172a;
}

.btn:disabled {
    background-color: #cbd5e1;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   4. ЛЕНТА ОБЛОЖЕК (INDEX FEED)
   ========================================================================== */
.feed-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding: 40px;
}

.cover-card {
    background-color: #ffffff; /* Белые карточки на сером фоне */
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    padding: 12px; /* Внутренний отступ для эстетики */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.cover-card:hover {
    transform: translateY(-4px);
    border-color: #facc15;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.image-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    background-color: #f1f5f9;
    border-radius: 8px;
    overflow: hidden;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-info {
    padding: 12px 4px 4px 4px;
}

.card-info h3 {
    margin: 0 0 6px 0;
    font-size: 17px;
    color: #0f172a;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-info p {
    margin: 0 0 10px 0;
    color: #64748b; /* Приглушенный текст */
    font-size: 14px;
}

/* ==========================================================================
   5. ФОРМА ЗАГРУЗКИ И АВТОРИЗАЦИИ (UPLOAD & AUTH FORMS)
   ========================================================================== */
.page-center {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.upload-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
}

.upload-container h2 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-align: center;
    margin-bottom: 30px;
    color: #0f172a;
}

.upload-container h2 span {
    color: #0f172a;
    background-color: #fde047;
    padding: 0 6px;
    border-radius: 6px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 700;
}

/* Чистые светлые инпуты */
input[type="text"], 
input[type="email"], 
input[type="password"],
input[type="number"], 
textarea {
    width: 100%;
    padding: 12px 16px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #0f172a;
    font-size: 15px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

/* Эффект фокуса с мягким желтым свечением */
input:focus, textarea:focus {
    outline: none;
    border-color: #facc15;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.25);
}

/* Зона Drag-and-Drop */
.file-drop-zone {
    border: 2px dashed #cbd5e1;
    padding: 40px 20px;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    background-color: #f8fafc;
    transition: all 0.2s ease;
}

.file-drop-zone:hover {
    border-color: #facc15;
    background-color: #ffffff;
}

.file-drop-zone i {
    font-size: 36px;
    color: #64748b;
    margin-bottom: 12px;
}

#file-input {
    display: none;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.back-link:hover {
    color: #0f172a;
}

/* Кнопка подтверждения на форме авторизации */
#auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: #fde047;
    border: none;
    border-radius: 10px;
    color: #0f172a;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(250, 204, 21, 0.2);
    transition: all 0.2s ease;
    margin-top: 15px;
}

#auth-submit-btn:hover {
    background: #facc15;
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(250, 204, 21, 0.3);
}

/* ==========================================================================
   6. КРУГЛАЯ ПЛАВАЮЩАЯ КНОПКА АДМИНА
   ========================================================================== */
.admin-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: #ef4444; /* Плоский красный, чтобы выделялся на светлом */
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
    z-index: 9999;
    transition: all 0.2s ease;
}

.admin-fab:hover {
    transform: scale(1.05);
    background: #dc2626;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}

/* ==========================================================================
   7. ВЫПАДАЮЩЕЕ МЕНЮ ПРОФИЛЯ С АВАТАРКОЙ
   ========================================================================== */
.profile-dropdown-container {
    position: relative;
    display: inline-block;
}

.avatar-btn {
    background: none;
    border: 2px solid #e2e8f0;
    padding: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.avatar-btn:hover {
    border-color: #facc15;
}

.avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-menu {
    position: absolute;
    top: 52px;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    width: 180px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    display: none;
    flex-direction: column;
    padding: 6px 0;
    z-index: 1000;
}

.dropdown-menu.show {
    display: flex;
}

.dropdown-menu a, .dropdown-menu button {
    background: none;
    border: none;
    color: #475569;
    padding: 10px 16px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.dropdown-menu a:hover, .dropdown-menu button:hover {
    background-color: #f1f5f9;
    color: #0f172a;
}

.dropdown-menu hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 6px 0;
}

.dropdown-menu .logout-item {
    color: #ef4444;
}

.dropdown-menu .logout-item:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

/* ==========================================================================
   8. ТОСТ-УВЕДОМЛЕНИЯ (СВЕТЛЫЙ ВАРИАНТ)
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 600;
    font-size: 15px;
    min-width: 280px;
    max-width: 400px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast.show {
    transform: translateX(0);
}

.toast-success { border-left: 4px solid #10b981; }
.toast-success i { color: #10b981; }

.toast-error { border-left: 4px solid #ef4444; }
.toast-error i { color: #ef4444; }

.toast-info { border-left: 4px solid #facc15; }
.toast-info i { color: #facc15; }

/* ==========================================================================
   9. АВАТАРКА НА СТРАНИЦЕ ПРОФИЛЯ
   ========================================================================== */
.profile-page-avatar-container {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 0 auto 15px;
    cursor: pointer;
}

.profile-page-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.change-avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.profile-page-avatar-container:hover .change-avatar-overlay {
    opacity: 1;
}

.change-avatar-overlay i {
    font-size: 22px;
    margin-bottom: 5px;
}

#avatar-input {
    display: none;
}

/* ==========================================================================
   СТИЛИ ДЛЯ СТРАНИЦЫ ДЕТАЛЬНОГО ПРОСМОТРА ОБЛОЖКИ (COVER.HTML)
   ========================================================================== */
.cover-detail-container {
    width: 100%;
    max-width: 950px;
    margin: 0 auto;
}

.cover-detail-block {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Ровно пополам */
    gap: 40px;
    background: #ffffff;
    padding: 30px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.03);
}

/* Адаптация под мобилки */
@media (max-width: 768px) {
    .cover-detail-block {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 20px;
    }
}

.detail-image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

.detail-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info-block {
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Контент сверху, кнопка скачивания строго снизу */
    padding: 10px 0;
}

.detail-title {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
    line-height: 1.2;
}

.detail-author {
    font-size: 15px;
    color: #64748b;
    font-weight: 600;
}

.detail-author a {
    color: #facc15;
    text-decoration: none;
    font-weight: 700;
}

.detail-author a:hover {
    text-decoration: underline;
}

.detail-desc-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 6px;
}

.detail-description {
    font-size: 15px;
    color: #334155;
    line-height: 1.5;
}

.detail-action-zone {
    margin-top: 30px;
}

.detail-limit-status {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ==========================================================================
   ЗАЩИТА ОТ КОПИРОВАНИЯ И ПЕРЕТАСКИВАНИЯ КАРТИНОК
   ========================================================================== */
img {
    -webkit-user-drag: none; /* Запрет перетаскивания картинок мышью */
    user-select: none;       /* Запрет выделения картинок */
    -webkit-user-select: none;
}

.cover-card, .cover-detail-block {
    user-select: none;       /* Запрет выделения текста внутри карточек */
    -webkit-user-select: none;
}