@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #09090b;
    --bg-card: #18181b;
    --border-color: #27272a;
    --primary: #3b82f6;
    --primary-gradient: linear-gradient(135deg, #3b82f6, #6366f1);
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #a1a1aa;
    --font-family: 'Inter', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.5;
    overflow-x: hidden; /* Защита от случайной горизонтальной прокрутки */
}

/* === НАВИГАЦИЯ === */
nav {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    padding: 20px;
    background: rgba(24, 24, 27, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 20px;
    z-index: 100;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    transition: all 0.3s;
}

nav a:hover, nav a.active {
    color: #fff;
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* === КНОПКИ И ШАПКА === */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.btn-primary { 
    background: var(--primary-gradient); 
    color: white; 
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover { 
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}
.btn-danger { background: var(--danger); color: white; }

/* === СЕТКА НОВОСТЕЙ === */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Уменьшено для лучшей адаптивности */
    gap: 25px;
    margin-top: 30px;
}

.news-article:first-child { grid-column: 1 / -1; min-height: 450px; }
.news-article:first-child .news-title { font-size: 2.5rem; }

.news-article {
    position: relative; border-radius: 20px; overflow: hidden;
    min-height: 300px; display: flex; align-items: flex-end;
    border: 1px solid var(--border-color); background: var(--bg-card);
    transition: transform 0.4s ease, border-color 0.4s ease;
}
.news-article:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: 0 15px 30px rgba(0,0,0,0.5); }
.news-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; transition: transform 0.6s ease; }
.news-article:hover .news-img { transform: scale(1.05); }
.news-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(9,9,11,0.95) 0%, rgba(9,9,11,0.4) 50%, rgba(9,9,11,0) 100%); z-index: 1;
}
.news-content { position: relative; z-index: 2; padding: 30px; width: 100%; }
.news-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 10px; line-height: 1.2; color: #fff; word-wrap: break-word; }
.news-date { color: var(--primary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

/* === СЕТКА ФИЛЬМОВ === */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px; margin-top: 30px;
}
.movie-card {
    background: var(--bg-card); border-radius: 16px; overflow: hidden; position: relative;
    border: 1px solid var(--border-color); transition: transform 0.3s; display: flex; flex-direction: column;
}
.movie-card:hover { transform: scale(1.03); border-color: #fff; }
.movie-poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: #111; }
.movie-info { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.movie-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; word-wrap: break-word; }

/* === ЗОНА ЗАГРУЗКИ (DROPZONE) === */
.dropzone {
    border: 2px dashed var(--border-color); border-radius: 12px; padding: 30px 20px; text-align: center;
    background: #09090b; color: var(--text-muted); cursor: pointer; transition: all 0.3s ease;
    margin: 8px 0 20px 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 120px;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: rgba(59, 130, 246, 0.05); color: #fff; }
.dropzone-content { display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.dropzone-icon { font-size: 2rem; margin-bottom: 5px; }
.dropzone input[type="file"] { display: none; }
.dropzone img { max-width: 100%; max-height: 180px; border-radius: 8px; object-fit: cover; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }

/* Общие элементы */
.delete-btn-corner {
    position: absolute; top: 15px; right: 15px; background: rgba(0,0,0,0.6); color: white;
    border: 1px solid rgba(255,255,255,0.2); border-radius: 50%; width: 36px; height: 36px;
    cursor: pointer; z-index: 10; backdrop-filter: blur(5px); transition: all 0.2s; font-size: 1.2rem;
}
.delete-btn-corner:hover { background: var(--danger); transform: scale(1.1); border-color: var(--danger); }

/* === МОДАЛЬНЫЕ ОКНА === */
dialog {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 20px;
    color: var(--text-main); padding: 30px; width: 90%; max-width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
dialog::backdrop { background-color: rgba(0, 0, 0, 0.8); backdrop-filter: blur(5px); }
dialog input, dialog textarea {
    background: #09090b; border: 1px solid var(--border-color); color: #fff; padding: 12px;
    width: 100%; box-sizing: border-box; margin: 8px 0 20px 0; border-radius: 10px; font-family: inherit; transition: border 0.3s;
}
dialog input:focus, dialog textarea:focus { outline: none; border-color: var(--primary); }
#confirmDialog { text-align: center; max-width: 340px; padding: 30px; }
#confirmDialog p { font-size: 1.1rem; margin-bottom: 25px; }
.confirm-buttons { display: flex; gap: 15px; }
.confirm-buttons button { flex: 1; }

/* === FULLCALENDAR ОБЩИЕ === */
.fc {
    --fc-border-color: #27272a !important; background-color: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 20px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.fc .fc-toolbar { display: flex !important; justify-content: space-between !important; align-items: center !important; margin-bottom: 25px !important; }
.fc .fc-toolbar-chunk { display: flex !important; flex-direction: row !important; align-items: center !important; gap: 12px !important; }
.fc .fc-button {
    display: inline-flex !important; align-items: center !important; justify-content: center !important; padding: 0 16px !important;
    height: 42px !important; font-size: 0.95rem !important; font-weight: 600 !important; border-radius: 10px !important;
    background-color: #09090b !important; border: 1px solid var(--border-color) !important; color: #fff !important; transition: all 0.2s !important;
}
.fc .fc-button:hover { border-color: var(--primary) !important; color: var(--primary) !important; }
.fc .fc-toolbar-title { font-size: 1.5rem !important; font-weight: 700 !important; }
.fc-col-header-cell { background-color: #09090b !important; padding: 12px 0 !important; }
.fc-v-event { background: var(--primary-gradient) !important; border: none !important; border-radius: 8px !important; padding: 6px !important; font-weight: 600; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

/* === СКРУГЛЕНИЕ УГЛОВ СЕТКИ === */
.fc-theme-standard .fc-scrollgrid { border-radius: 16px; overflow: hidden; border-collapse: separate; border: none !important; box-shadow: 0 0 0 1px var(--border-color); }
.fc-theme-standard th:first-child { border-top-left-radius: 16px; }
.fc-theme-standard th:last-child { border-top-right-radius: 16px; }
.fc-theme-standard th, .fc-theme-standard td { border-right: 1px solid var(--border-color) !important; border-bottom: 1px solid var(--border-color) !important; }
.fc-theme-standard th:last-child, .fc-theme-standard td:last-child { border-right: none !important; }
.fc-theme-standard .fc-scrollgrid-corner, .fc-timegrid-axis-frame, .fc-timegrid-axis { background-color: #09090b !important; }

/* === КРАСИВАЯ СЕТКА (ЗЕБРА И ЛИНИИ) === */
.fc-theme-standard .fc-timegrid-slot-major td { border-top: 1px solid #3f3f46 !important; }
.fc-theme-standard .fc-timegrid-slot-minor td { border-top: 1px dashed rgba(255, 255, 255, 0.05) !important; }
.fc-timegrid-col.fc-day-today { background-color: rgba(59, 130, 246, 0.05) !important; }
.fc-highlight { background: rgba(99, 102, 241, 0.25) !important; border: 1px solid rgba(99, 102, 241, 0.8) !important; border-radius: 6px; }
.fc-timegrid-now-indicator-line { border-color: var(--danger) !important; border-width: 2px !important; box-shadow: 0 0 10px rgba(239, 68, 68, 0.5); z-index: 10 !important; }
.fc-timegrid-now-indicator-arrow { border-color: var(--danger) !important; border-width: 6px !important; }
.fc-timegrid-axis-cushion { color: #f8fafc !important; font-weight: 700 !important; font-size: 0.85rem !important; padding-right: 15px !important; }

/* Вертикальная зебра по часам */
.fc-timegrid-slots tr:nth-child(8n-7) .fc-timegrid-slot-lane, .fc-timegrid-slots tr:nth-child(8n-6) .fc-timegrid-slot-lane,
.fc-timegrid-slots tr:nth-child(8n-5) .fc-timegrid-slot-lane, .fc-timegrid-slots tr:nth-child(8n-4) .fc-timegrid-slot-lane { background-color: rgba(255, 255, 255, 0.02) !important; }
.fc-timegrid-slots tr:nth-child(8n-3) .fc-timegrid-slot-lane, .fc-timegrid-slots tr:nth-child(8n-2) .fc-timegrid-slot-lane,
.fc-timegrid-slots tr:nth-child(8n-1) .fc-timegrid-slot-lane, .fc-timegrid-slots tr:nth-child(8n) .fc-timegrid-slot-lane { background-color: transparent !important; }
.fc-timegrid-col { background-color: transparent !important; }


/* =========================================================
   МОБИЛЬНАЯ АДАПТИВНОСТЬ (Телефоны и планшеты < 768px) 
   ========================================================= */
@media (max-width: 768px) {
    body { padding: 12px; }

    /* Навигация превращается в удобные табы */
    nav {
        flex-direction: row; flex-wrap: nowrap; padding: 10px; gap: 8px;
        position: sticky; top: 10px; border-radius: 12px; overflow-x: auto;
    }
    nav a {
        flex: 1; text-align: center; padding: 10px 5px; font-size: 0.9rem;
        background: rgba(255, 255, 255, 0.03); border-radius: 8px;
    }
    nav a.active { background: rgba(255, 255, 255, 0.15); }

    /* Шапки страниц */
    .header-actions { flex-direction: column; text-align: center; gap: 15px; align-items: stretch; }
    h1 { font-size: 2rem !important; margin: 0; }
    .header-actions .btn { width: 100%; }

    /* Сетка новостей на 1 колонку */
    .news-grid { grid-template-columns: 1fr; gap: 20px; }
    .news-article:first-child { min-height: 280px; }
    .news-article:first-child .news-title { font-size: 1.6rem !important; }
    .news-article { min-height: 240px; }
    .news-content { padding: 20px; }

    /* Сетка фильмов (2 в ряд на планшете, 1 на мелком телефоне) */
    .movies-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; }

    /* Модальные окна (диалоги) на весь экран */
    dialog {
        padding: 25px 20px; width: calc(100% - 30px); max-width: none;
        margin: auto; box-sizing: border-box;
    }

    /* Адаптация шапки календаря */
    .fc { padding: 15px; }
    .fc .fc-toolbar { flex-direction: column !important; gap: 15px !important; }
    .fc .fc-toolbar-chunk { justify-content: center !important; flex-wrap: wrap; gap: 8px !important; }
    .fc .fc-toolbar-title { font-size: 1.2rem !important; }
    .fc .fc-button { padding: 0 12px !important; height: 38px !important; font-size: 0.85rem !important; }

    /* Меньше отступов в дропзоне */
    .dropzone { padding: 20px 10px; min-height: 100px; }

    /* Шапки страниц (Заголовок сверху, кнопка под ним на всю ширину) */
    .header-actions { 
        flex-direction: column; 
        align-items: stretch; /* Кнопка растянется на весь экран */
        gap: 15px; 
        margin-bottom: 25px;
    }
    h1 { 
        font-size: 1.8rem !important; 
        margin: 0; 
        text-align: center;
        line-height: 1.2;
    }

    /* Исправляем гигантский текст новостей на мобилках */
    .news-article:first-child .news-title { 
        font-size: 1.3rem !important; 
    }
    .news-title { 
        font-size: 1.1rem !important; 
        line-height: 1.3;
    }
}
