/* ==================== ОБЩИЕ НАСТРОЙКИ ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9fb;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: Georgia, serif;
    color: #4a2c2c;
    margin-bottom: 15px;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* ==================== ШАПКА И МЕНЮ ==================== */
.header {
    background: #800020;
    color: #fff;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    font-size: 2rem;
}

.user-widget {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    background: #f7dfaf;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Навигация */
.navbar {
    background: #4a2c2c;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 0;
}

.navbar ul li {
    margin: 0 15px;
}

.navbar ul li a {
    color: #f7dfaf;
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.3s;
}

.navbar ul li a:hover {
    color: #fff;
    text-decoration: underline;
}

/* ==================== СЕКЦИИ ==================== */
.section {
    padding: 60px 0;
}

.bg-light {
    background-color: #fff;
}

.bg-white {
    background-color: #f4ece1;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 80px;
    height: 3px;
    background: #800020;
    margin: 10px auto 0;
}

/* Сетка (вместо Bootstrap) */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-md-4, .col-md-3, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-12, .col-6 {
    padding: 15px;
    flex: 1;
}

.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-md-5 { flex: 0 0 41.666%; max-width: 41.666%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-7 { flex: 0 0 58.333%; max-width: 58.333%; }
.col-md-8 { flex: 0 0 66.666%; max-width: 66.666%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }

/* ==================== КАРТОЧКИ КНИГ ==================== */
.books-grid, .bestseller-track {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.book-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.book-cover {
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: #f7dfaf;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.book-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.book-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.book-author {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.book-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: #800020;
}

.old-price {
    text-decoration: line-through;
    color: #999;
    font-size: 1rem;
    margin-right: 10px;
}

.discount-badge {
    background: #dc3545;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 10px;
    vertical-align: middle;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.3s;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: #800020;
    color: #fff;
}

.btn-primary:hover {
    background: #600018;
}

.btn-gold, .btn-cart {
    background: #e6a700;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-gold:hover, .btn-cart:hover {
    background: #cc9200;
}

.btn-outline, .btn-outline-secondary {
    background: transparent;
    border: 2px solid #800020;
    color: #800020;
}

.btn-outline:hover, .btn-outline-secondary:hover {
    background: #800020;
    color: #fff;
}

/* ==================== ФОРМЫ И МОДАЛЬНЫЕ ОКНА ==================== */
.form-box {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #800020;
    box-shadow: 0 0 5px rgba(128, 0, 32, 0.2);
}

label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

dialog {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 600px;
    padding: 0;
    margin: auto;
}

dialog::backdrop {
    background: rgba(0,0,0,0.5);
}

.modal-header {
    background: #800020;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h5 {
    margin: 0;
    color: #fff;
}

.btn-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    background: #f9f9f9;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #eee;
}

/* Табы (Вход / Регистрация) */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.tabs button {
    background: transparent;
    border: none;
    padding: 10px 15px;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tabs button.active {
    color: #800020;
    border-bottom-color: #800020;
}

/* ==================== КОРЗИНА ==================== */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child {
    border-bottom: none;
}

/* ==================== ПОДВАЛ ==================== */
.footer {
    background: #2c1a1a;
    color: #ddd;
    padding: 40px 0 20px;
    margin-top: 50px;
}

.footer h5 {
    color: #f7dfaf;
    margin-bottom: 15px;
}

.social-icons a {
    display: inline-block;
    width: 35px;
    height: 35px;
    background: #4a2c2c;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    line-height: 35px;
    margin-right: 10px;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.social-icons a:hover {
    background: #800020;
}

.border-top {
    border-top: 1px solid #444;
    margin-top: 30px;
    padding-top: 20px;
    text-align: center;
    font-size: 0.9rem;
}

/* ==================== АДАПТИВНОСТЬ ==================== */
@media (max-width: 768px) {
    .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .navbar ul {
        flex-direction: column;
        align-items: center;
    }
    .navbar ul li {
        margin: 5px 0;
    }
    .header-container {
        flex-direction: column;
        gap: 15px;
    }
}
