/* ============================================================
   БАЗОВЫЕ СТИЛИ
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 18px;
    line-height: 1.8;
    max-width: 100%;
    margin: 0;
    padding: 20px;
    color: #4a3520;
    background: #f7f2ed;
    min-height: 100vh;
}

/* ============================================================
   ШАПКА
   ============================================================ */
header {
    background: linear-gradient(135deg, #8B5A5A 0%, #BC8F8F 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 16px;
    margin-bottom: 25px;
    box-shadow: 0 6px 25px rgba(139, 69, 19, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

header h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

header h1::before {
    content: ' ';
}

nav {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

nav a {
    color: rgba(255, 255, 255, 0.9);
    margin-right: 18px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

nav a:hover {
    color: #ffffff;
    border-bottom: 2px solid #FFDAB9;
    transform: translateY(-1px);
}

/* ============================================================
   ОСНОВНОЙ КОНТЕНТ
   ============================================================ */
.content {
    background: #ffffff;
    padding: 30px 35px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(139, 69, 19, 0.08);
    min-height: 400px;
    border: 1px solid #f0e8e0;
}

h1 {
    color: #8B4513;
    margin-bottom: 18px;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    position: relative;
    padding-bottom: 12px;
}

h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #BC8F8F, #FFDAB9);
    border-radius: 2px;
}

h2 {
    color: #8B4513;
    margin: 25px 0 15px 0;
    font-size: 1.5rem;
    font-weight: 600;
}

h3 {
    color: #8B4513;
    margin: 15px 0 10px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

/* ============================================================
   КАРТОЧКИ КНИГ
   ============================================================ */
.book-card {
    border: 1px solid #e8ddd0;
    padding: 20px;
    margin: 15px 0;
    border-radius: 12px;
    background: #fcf9f6;
    display: flex;
    gap: 20px;
    align-items: start;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.05);
}

.book-card:hover {
    box-shadow: 0 8px 30px rgba(139, 69, 19, 0.12);
    transform: translateY(-3px);
    border-color: #BC8F8F;
}

.book-card .cover {
    flex-shrink: 0;
    width: 120px;
    height: 160px;
    background: #eee5dc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.book-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-card .cover .no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 48px;
    color: #b8a99a;
    background: #f0e8e0;
}

.book-card .info {
    flex: 1;
}

.book-card h3 {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
}

.book-card h3 a {
    color: #8B4513;
    text-decoration: none;
    transition: color 0.3s ease;
}

.book-card h3 a:hover {
    color: #BC8F8F;
    text-decoration: none;
}

.book-card .meta {
    color: #8a7a6a;
    font-size: 0.9em;
    margin-bottom: 6px;
}

.book-card p {
    margin: 5px 0;
    color: #5a4a3a;
    line-height: 1.6;
}

/* ============================================================
   КНОПКИ
   ============================================================ */
.btn {
    display: inline-block;
    padding: 10px 22px;
    background: linear-gradient(135deg, #BC8F8F, #a87a7a);
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(188, 143, 143, 0.3);
    letter-spacing: 0.3px;
}

.btn:hover {
    background: linear-gradient(135deg, #a87a7a, #8B5A5A);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(188, 143, 143, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, #a8b5a0, #8ba38a);
    box-shadow: 0 2px 8px rgba(139, 163, 138, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #8ba38a, #6d8a6c);
    box-shadow: 0 6px 20px rgba(139, 163, 138, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #d4a0a0, #c08080);
    box-shadow: 0 2px 8px rgba(192, 128, 128, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c08080, #a06060);
    box-shadow: 0 6px 20px rgba(192, 128, 128, 0.4);
}

/* ============================================================
   ФОРМЫ
   ============================================================ */
form label {
    display: block;
    margin: 14px 0 6px 0;
    font-weight: 600;
    color: #4a3520;
}

form input,
form textarea,
form select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e8ddd0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    box-sizing: border-box;
    background: #fcf9f6;
    transition: all 0.3s ease;
}

form input:focus,
form textarea:focus,
form select:focus {
    border-color: #BC8F8F;
    outline: none;
    box-shadow: 0 0 0 4px rgba(188, 143, 143, 0.15);
    background: #ffffff;
}

form textarea {
    min-height: 120px;
    resize: vertical;
}

form button {
    margin-top: 18px;
}

/* ============================================================
   ОШИБКИ
   ============================================================ */
.error {
    color: #8b3a3a;
    background: #fde8e8;
    padding: 18px 22px;
    border-radius: 10px;
    border: 1px solid #e8b8b8;
    margin: 18px 0;
}

.error ul {
    margin: 5px 0 0 20px;
}

/* ============================================================
   БЭЙДЖИ
   ============================================================ */
.badge-new {
    background: linear-gradient(135deg, #FFDAB9, #f5c8a0);
    color: #5a3a2a;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.7em;
    margin-left: 8px;
    font-weight: 600;
    display: inline-block;
}

.badge-old {
    background: linear-gradient(135deg, #d4c8b8, #c0b0a0);
    color: #5a4a3a;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.7em;
    margin-left: 8px;
    font-weight: 600;
}

.badge-modern {
    background: linear-gradient(135deg, #d4c0b8, #c0a8a0);
    color: #4a3a3a;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.7em;
    margin-left: 8px;
    font-weight: 600;
}

/* ============================================================
   СТАТИСТИКА
   ============================================================ */
.stats-box {
    background: #fcf6f0;
    padding: 20px;
    border-radius: 12px;
    margin: 18px 0;
    border: 1px solid #f0e8e0;
}

.stats-box ul {
    list-style: none;
    padding: 0;
}

.stats-box li {
    padding: 8px 0;
    border-bottom: 1px solid #f0e8e0;
}

.stats-box li:last-child {
    border-bottom: none;
}

/* ============================================================
   ФИЛЬТРЫ
   ============================================================ */
.filter-box {
    background: #fcf6f0;
    padding: 18px 22px;
    border-radius: 12px;
    margin: 18px 0;
    border: 1px solid #f0e8e0;
}

.filter-box form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
}

.filter-box form div {
    flex: 1;
    min-width: 150px;
}

.filter-box form label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.85em;
    color: #6a5a4a;
}

.filter-box form input {
    width: 100%;
    padding: 10px 12px;
}

/* ============================================================
   АКТИВНЫЕ ФИЛЬТРЫ
   ============================================================ */
.active-filters {
    background: #fcf0e8;
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 18px;
    border: 1px solid #f0ddd0;
    color: #6a4a3a;
}

/* ============================================================
   СЕТКА КНИГ
   ============================================================ */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 24px;
}

.book-grid .book-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 0;
    padding: 18px;
}

.book-grid .book-card .cover {
    width: 100%;
    height: 280px;
    border-radius: 10px;
}

.book-grid .book-card .info {
    width: 100%;
}

/* ============================================================
   ФУТЕР
   ============================================================ */
footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 2px solid #f0e8e0;
    color: #8a7a6a;
    font-size: 14px;
    text-align: center;
    font-family: 'Georgia', serif;
}

/* ============================================================
   ДЕТАЛЬНАЯ СТРАНИЦА
   ============================================================ */
.book-detail {
    display: flex;
    gap: 35px;
    align-items: start;
}

.book-detail .cover {
    flex-shrink: 0;
    width: 260px;
    height: 360px;
    background: #eee5dc;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.book-detail .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-detail .cover .no-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 64px;
    color: #b8a99a;
    background: #f0e8e0;
}

.book-detail .info {
    flex: 1;
}

.book-detail .info h1 {
    margin-top: 0;
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    header {
        padding: 18px 20px;
    }

    header h1 {
        font-size: 24px;
    }

    .content {
        padding: 20px;
    }

    .book-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .book-card .cover {
        width: 100%;
        max-width: 200px;
        height: 260px;
    }

    .book-detail {
        flex-direction: column;
        align-items: center;
    }

    .book-detail .cover {
        width: 100%;
        max-width: 280px;
        height: 380px;
    }

    .filter-box form {
        flex-direction: column;
    }

    .filter-box form div {
        min-width: 100%;
    }

    nav {
        gap: 6px;
    }

    nav a {
        font-size: 0.85rem;
        margin-right: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .content {
        padding: 15px;
    }

    .book-grid {
        grid-template-columns: 1fr;
    }

    .book-detail .cover {
        max-width: 200px;
        height: 280px;
    }
}

/* ============================================================
   АНИМАЦИИ (дополнительно)
   ============================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content {
    animation: fadeInUp 0.5s ease;
}

/* Стили для скролла */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f0e8e0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #BC8F8F;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a87a7a;
}