/*
 * Lilia Sedova - Candles Website
 * Main Stylesheet
 * Version: 1.0
 */

/* === 1. ГЛОБАЛЬНЫЕ НАСТРОЙКИ И ПЕРЕМЕННЫЕ === */
:root {
    --primary-color: #6a5acd;   /* Глубокий фиолетовый */
    --secondary-color: #f4e8d8; /* Теплый бежевый */
    --text-color: #333;
    --light-text-color: #777;
    --bg-color: #fff;
    --light-bg-color: #fcfaf7; /* Очень светлый бежевый для фона секций */
    --font-family: 'Montserrat', sans-serif;
    --border-radius: 8px;
    --header-height: 80px; /* Высота шапки для отступа */
}

/* === 2. БАЗОВЫЕ СТИЛИ И СБРОС === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4 {
    line-height: 1.3;
}
.section-title {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 50px;
}
.subtitle {
    text-align: center;
    max-width: 600px;
    margin: -30px auto 50px;
    color: var(--light-text-color);
}

/* === 3. УТИЛИТЫ И ОБЩИЕ КЛАССЫ === */
.btn {
    display: inline-block;
    padding: 12px 25px;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.btn:hover {
    background-color: #483d8b;
    text-decoration: none;
    transform: translateY(-2px);
}
.btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: normal;
}
.errors { background-color: #f8d7da; color: #721c24; padding: 15px; border-radius: var(--border-radius); margin-bottom: 20px;}
.success { background-color: #d4edda; color: #155724; padding: 15px; border-radius: var(--border-radius); margin-bottom: 20px;}


/* === 4. ШАПКА И ПОДВАЛ === */
.main-header {
    /* ИСПРАВЛЕНИЕ: Делаем шапку плавающей над контентом */
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000; /* Высокий z-index, чтобы шапка была поверх ВСЕГО */
    padding: 20px 0;
    transition: background-color 0.3s ease;
}
.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.main-header .logo,
.main-header .main-nav a,
.main-header .header-actions a {
    color: #fff; /* Белый цвет текста для хорошей видимости на картинке */
    font-weight: bold;
}
.main-header .admin-link { color: #ffdddd; }

.main-nav a, .header-actions a { margin-left: 20px; }
.cart-link { position: relative; }
.cart-counter {
    position: absolute;
    top: -8px;
    right: -15px;
    background-color: #d9534f;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

main {
    /* ИСПРАВЛЕНИЕ: Добавляем отступ сверху, чтобы контент не залезал под плавающую шапку */
    /* Этот отступ нужен только для страниц, где нет Hero-блока */
    padding-top: var(--header-height);
}
/* Для главной страницы отступ не нужен, так как Hero-блок занимает весь экран */
body:has(.hero-section) main {
    padding-top: 0;
}

.main-footer {
    padding: 40px 0;
    background-color: #f9f9f9;
    text-align: center;
    margin-top: 60px;
    border-top: 1px solid #eee;
}

/* === 5. СТИЛИ ГЛАВНОЙ СТРАНИЦЫ === */
.hero-section {
    position: relative;
    height: 80vh;
    min-height: 600px;
    background: url('../assets/img/hero-background.jpg') no-repeat center center/cover;
    color: #fff;
    display: flex;
    align-items: center;
    text-align: center;
}
.hero-overlay {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1;
}
.hero-content {
    position: relative;
    z-index: 2;
}
.hero-title { font-size: 3.5rem; margin-bottom: 20px; }
.hero-subtitle { font-size: 1.2rem; max-width: 600px; margin: 0 auto 40px; }
.btn-hero { padding: 15px 35px; font-size: 1.1rem; background-color: var(--secondary-color); color: var(--text-color); }
.btn-hero:hover { background-color: #e8d9c5; }

.about-section, .features-section { padding: 80px 0; }
.popular-products-section, .blog-preview-section { padding: 80px 0; background-color: var(--light-bg-color); }

.about-section { display: flex; align-items: center; gap: 60px; }
.about-image { flex: 1; max-width: 450px; }
.about-image img { border-radius: var(--border-radius); }
.about-text { flex: 1.2; }
.about-text h2 { text-align: left; margin-bottom: 10px; }
.about-text h3 { font-size: 1.2rem; color: #777; margin-bottom: 20px; }

.features-section { display: flex; justify-content: space-around; text-align: center; gap: 30px; }
.feature-item { max-width: 300px; }
.feature-icon { height: 60px; margin-bottom: 20px; }

/* === 6. СТИЛИ КАРТОЧЕК (ТОВАРЫ, ПОСТЫ) === */
.product-grid, .posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}
.product-card, .post-card {
    border: 1px solid #eee;
    background-color: #fff;
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.product-card:hover, .post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}
.product-card-image { overflow: hidden; }
.product-card-image img { width: 100%; height: 300px; object-fit: cover; transition: transform 0.4s ease; }
.product-card:hover .product-card-image img { transform: scale(1.05); }
.product-card-content { padding: 20px; }
.product-card h3 { margin-bottom: 10px; }
.price { font-weight: bold; font-size: 1.1rem; }
.page-catalog .add-to-cart-btn { margin: 0 20px 20px; }

.post-card { padding: 25px; }
.post-card .post-excerpt { color: #555; margin: 10px 0 15px; }
.post-card .read-more { font-weight: bold; color: var(--primary-color); }

/* === 7. СТИЛИ БЛОГА И ТЕКСТОВЫХ СТРАНИЦ === */
.page-blog .blog-posts-list { max-width: 800px; margin: 0 auto; }
.post-preview { margin-bottom: 50px; border-bottom: 1px solid #eee; padding-bottom: 30px; }
.post-preview h2 a { color: var(--text-color); }
.post-meta { font-size: 0.9rem; color: #777; margin-bottom: 15px; }
.btn-read-more { font-weight: bold; }

.pagination { text-align: center; margin-top: 40px; }
.pagination a { display: inline-block; padding: 8px 15px; margin: 0 5px; border: 1px solid #ddd; border-radius: var(--border-radius); }
.pagination a.active { background-color: var(--primary-color); color: #fff; border-color: var(--primary-color); }

.page-post, .text-page { max-width: 800px; margin: 40px auto; }
.single-post .post-content { margin-top: 30px; font-size: 1.1rem; line-height: 1.8; }
.text-center { text-align: center; padding: 60px 0; }
.text-center h1 { font-size: 5rem; }


/* === 8. СТИЛИ ФОРМ И СТРАНИЦЫ ВХОДА === */
.page-login { display: flex; justify-content: center; padding: 40px 0; }
.login-form-container { max-width: 450px; width: 100%; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: var(--font-family);
}
.contacts-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 50px; margin-top: 40px; }

/* === 9. КОРЗИНА И ОФОРМЛЕНИЕ ЗАКАЗА === */
.cart-table, table { width: 100%; border-collapse: collapse; margin-top: 30px; }
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #eee; }
th { background-color: #f9f9f9; }
.cart-summary { margin-top: 30px; text-align: right; }
.cart-summary h2 { text-align: right; }

.checkout-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; }
.order-summary { background-color: #f9f9f9; padding: 30px; border-radius: var(--border-radius); height: fit-content; }
.order-summary h2 { text-align: left; }
.order-item, .order-total-row { display: flex; justify-content: space-between; margin-bottom: 15px; }
.final-total { font-size: 1.2rem; font-weight: bold; }

/* === 10. ЛИЧНЫЙ КАБИНЕТ И АДМИНКА === */
.page-account .account-content { display: flex; gap: 40px; margin-top: 40px; }
.account-menu { flex-shrink: 0; width: 200px; display: flex; flex-direction: column; }
.account-menu a { padding: 10px; border-radius: var(--border-radius); }
.account-menu a.active { background-color: var(--secondary-color); font-weight: bold; }
.account-details { flex-grow: 1; }

/* Статусы заказов и тикетов */
.status-new { color: #5bc0de; font-weight: bold; }
.status-awaiting_payment { color: #f0ad4e; font-weight: bold; }
.status-in_progress { color: var(--primary-color); font-weight: bold; }
.status-shipping { color: #337ab7; font-weight: bold; }
.status-completed { color: #5cb85c; font-weight: bold; }
.status-ticket-open { color: #f0ad4e; font-weight: bold; }
.status-ticket-resolved { color: #5cb85c; }

.page-admin { background-color: #f8f9fa; }
.admin-nav { display: flex; gap: 10px; background-color: #fff; padding: 10px 20px; border-radius: var(--border-radius); margin: 20px 0; border: 1px solid #ddd; }
.admin-nav a { padding: 8px 15px; border-radius: 6px; font-weight: bold; color: #555; }
.admin-nav a:hover { background-color: #eee; text-decoration: none; }
.admin-nav a.active { background-color: var(--primary-color); color: #fff; }
.admin-table-container { background: #fff; padding: 20px; border-radius: var(--border-radius); border: 1px solid #ddd; }
.order-view-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 30px; margin: 20px 0 40px; }
.order-details-card { background: #fff; padding: 25px; border-radius: var(--border-radius); border: 1px solid #eee; }

/* === 11. АДАПТИВНОСТЬ (MEDIA QUERIES) === */
@media (max-width: 992px) {
    .checkout-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .main-header .container { flex-direction: column; gap: 15px; }
    .hero-title { font-size: 2.5rem; }
    .about-section { flex-direction: column; }
    .features-section { flex-direction: column; }
    .contacts-grid { grid-template-columns: 1fr; }
    .page-account .account-content { flex-direction: column; }
    .account-menu { width: 100%; flex-direction: row; justify-content: center; }
}