/* --- ОСНОВНІ НАЛАШТУВАННЯ ТА ЗМІННІ --- */
:root {
    --primary: #1a2a3a;    /* Глибокий темно-синій */
    --accent: #d4af37;     /* Золотий (імперський) */
    --bg: #fdfaf5;         /* Колір старого паперу */
    --text: #333;
    --white: #ffffff;
    --success: #27ae60;    /* Зелений */
    --danger: #e74c3c;     /* Червоний */
}

/* --- ЗАГАЛЬНІ СТИЛІ --- */
body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

header {
    background: var(--primary);
    color: var(--white);
    padding: 30px 15px;
    text-align: center;
    border-bottom: 4px solid var(--accent);
}

header h1 { margin: 0; font-size: 2rem; }

/* --- ГАЛЕРЕЯ ТА ЦЕНТРУВАННЯ КОНТЕНТУ --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Центруємо заголовки та тексти в контейнері */
.container h2, 
.container p {
    text-align: center;
}

.gallery-grid {
    display: grid;
    /* auto-fit дозволяє сітці не розтягувати порожні колонки */
    grid-template-columns: repeat(auto-fit, minmax(280px, 320px));
    /* ЦЕЙ РЯДОК ЦЕНТРУЄ КАРТКИ ПОСЕРЕДИНІ: */
    justify-content: center; 
    gap: 40px;
    padding: 40px 0;
    width: 100%;
}

.item-card {
    background: var(--white);
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    transition: 0.3s;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.item-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.img-container img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.category-info { padding: 15px; }
.title-ua { font-weight: bold; color: var(--primary); display: block; }

/* --- МОДАЛЬНЕ ВІКНО (LIGHTBOX) --- */
#lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#lightbox img {
    max-width: 90%;
    max-height: 85%;
    border: 3px solid white;
}

/* --- АДМІН-ПАНЕЛЬ (ADMIN.PHP) --- */
.admin-panel {
    background: white;
    padding: 20px;
    margin: 20px auto;
    max-width: 1300px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

.admin-flex {
    display: flex;
    gap: 20px;
}

.admin-sidebar {
    flex: 1;
    min-width: 350px;
}

.admin-content {
    flex: 2;
}

.box {
    margin-bottom: 20px;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    text-align: center;
}

.btn:hover { opacity: 0.9; }

/* Повідомлення про успіх/помилку */
.alert {
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

/* --- ФІКС ФУТЕРА (ЦЕНТРУВАННЯ) --- */
footer {
    clear: both;             /* Очищаємо обтікання */
    display: block;          /* Блочний елемент */
    width: 100%;             /* На всю ширину */
    text-align: center;      /* Текст посередині */
    padding: 40px 0;         /* Відступи */
    margin-top: 60px;        /* Відступ зверху */
    color: #888;
    font-size: 0.85rem;
    border-top: 1px solid #eee;
    box-sizing: border-box;
}

/* Адаптивність для мобільних пристроїв */
@media (max-width: 900px) {
    .admin-flex { flex-direction: column; }
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}
