/* ===== БИБЛИОТЕЧНЫЙ СТИЛЬ (ОСНОВА) ===== */
:root {
    --bg: #fdfaf7;
    --bg-alt: #f5f1eb;
    --text: #2e2b28;
    --text-light: #5f5b58;
    --accent: #1e2a47;
    --accent-light: #2c3e5c;
    --gold: #b68b40;
    --gold-light: #e3c794;
    --border: #dad3cb;
    --shadow: 0 8px 20px rgba(0,0,0,0.04);
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Libre Baskerville', Georgia, serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

h1, h2, h3, h4, .logo, .btn {
    font-family: var(--font-serif);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ===== ШАПКА ===== */
.header {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    background-color: rgba(253, 250, 247, 0.95);
    backdrop-filter: blur(4px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--gold);
    font-size: 2rem;
}

.nav__list {
    display: flex;
    gap: 40px;
}

.nav__link {
    font-size: 1.1rem;
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
}

.nav__link:hover {
    color: var(--gold);
}

.nav__link.active {
    color: var(--gold);
    border-bottom: 2px solid var(--gold);
}

.nav__link::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--gold);
    transition: width 0.3s;
}

/* Убираем анимацию у активной ссылки, чтобы не было двойной полоски */
.nav__link.active::after {
    display: none;
}

.nav__link:hover::after {
    width: 100%;
}

.burger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.burger span {
    width: 100%;
    height: 2px;
    background-color: var(--accent);
    transition: all 0.3s;
}

/* ===== СЕКЦИИ ===== */
.section-header {
    text-align: center;
    margin-bottom: 70px;
}

.section-title {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 2px;
    background: var(--gold);
    margin: 15px auto 0;
}

.section-subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    font-style: italic;
}

/* ===== КАРТОЧКА КНИГИ (библиотека) ===== */
.books {
    padding: 80px 0;
}

.books__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(550px, 1fr));
    gap: 40px;
}

.book-card {
    display: flex;
    flex-direction: row;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 30px rgba(0,0,0,0.06);
}

/* Заглушка обложки */
.book-card__cover {
    flex: 0 0 200px;
    background: linear-gradient(145deg, var(--accent), #15202b);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.cover-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 20px;
    width: 100%;
    height: 100%;
}

.cover-placeholder i {
    font-size: 3.5rem;
    margin-bottom: 15px;
    color: var(--gold);
    opacity: 0.9;
}

.cover-placeholder span {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}

.cover-author {
    font-size: 0.9rem !important;
    margin-top: 8px;
    font-style: italic;
    opacity: 0.9;
}

.book-card__info {
    flex: 1;
    padding: 25px;
    background: white;
}

.book-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.book-card__title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
    font-family: var(--font-serif);
}

.book-card__author {
    font-size: 1rem;
    color: var(--gold);
    margin-bottom: 20px;
    font-style: italic;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 12px;
}

/* Первая и последняя строки */
.spoiler-lines {
    background: var(--bg-alt);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--gold);
}

.first-line, .last-line {
    margin-bottom: 8px;
}

.first-line .label, .last-line .label {
    font-weight: 700;
    color: var(--accent);
    margin-right: 8px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===== РЕЙТИНГ ЧАШКАМИ ===== */
.book-card__rating {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.rating-label {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.95rem;
    margin-right: 15px;
}

.mug-rating {
    display: flex;
    gap: 4px;
    align-items: center;
}

.mug-icon {
    font-size: 1.2rem;
    color: var(--border);
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    position: relative;
}

.mug-icon.active {
    color: var(--gold);
}

.mug-icon:hover {
    transform: scale(1.15);
}

/* Дымок только у выбранной чашки */
.mug-icon .smoke {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: var(--gold-light);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.mug-icon.smoking .smoke {
    opacity: 1;
}

/* ===== ДЕЙСТВИЯ С КНИГОЙ ===== */
.book-actions {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.action-icon {
    font-size: 1.4rem;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    position: relative;
}

.action-icon:hover {
    color: var(--gold);
    transform: scale(1.1);
}

/* ===== КНОПКА ИЗБРАННОГО (СТОПКА КНИГ) ===== */
.favorite-btn {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    color: rgba(80, 70, 60, 0.5);
    cursor: pointer;
    transition: color 0.2s, opacity 0.2s;
    padding: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.favorite-btn:hover {
    color: var(--gold);
    opacity: 1;
}

.favorite-btn.active {
    color: #b38b4a;
    opacity: 1;
}

/* ===== РИСОВАННАЯ ПОЛКА ===== */
.shelf-container {
    background: #e8e0d6;
    padding: 40px 30px 50px;
    border-radius: 30px 30px 15px 15px;
    box-shadow: 
        inset 0 -12px 0 rgba(0,0,0,0.04),
        inset 0 2px 0 rgba(255,255,255,0.5),
        0 15px 30px rgba(0,0,0,0.05);
    position: relative;
    margin-top: 20px;
    background-image: 
        repeating-linear-gradient(
            90deg,
            rgba(0,0,0,0.02) 0px,
            rgba(0,0,0,0.02) 2px,
            transparent 2px,
            transparent 8px
        ),
        linear-gradient(145deg, #e8e0d6 0%, #dbd2c8 100%);
}

/* Эффект «дощечек» — вертикальные линии */
.shelf-container::after {
    content: '';
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 20px;
    right: 20px;
    background: repeating-linear-gradient(
        90deg,
        rgba(0,0,0,0.02) 0px,
        rgba(0,0,0,0.02) 1px,
        transparent 1px,
        transparent 20px
    );
    pointer-events: none;
    border-radius: 10px;
}

/* Верхняя планка */
.shelf-container::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 5%;
    width: 90%;
    height: 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 20px;
    filter: blur(2px);
}

.books-shelf {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-end;
    justify-content: flex-start;
}

.shelf-book {
    position: relative;
    background: linear-gradient(145deg, #f3ede7, #e5ddd5);
    width: 200px;
    min-height: 210px;
    border-radius: 8px 8px 0 0;
    padding: 18px 16px;
    box-shadow: -5px 0 0 rgba(0,0,0,0.02), 8px 8px 20px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    border-left: 8px solid #a89888;
    transform: rotate(0.5deg);
    transition: transform 0.2s, border-left-color 0.2s;
}

.shelf-book:hover {
    transform: rotate(0deg) scale(1.02);
    border-left-color: var(--gold);
}

.shelf-book-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--accent);
    word-break: break-word;
    font-family: var(--font-serif);
    line-height: 1.3;
}

.shelf-book-author {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 10px;
}

.shelf-book-snippet {
    font-size: 0.8rem;
    color: #5f5b58;
    background: rgba(255,255,255,0.5);
    padding: 8px 10px;
    border-radius: 4px;
    border-left: 2px solid var(--gold);
    margin-top: auto;
}

/* Кнопка удаления с полки */
.shelf-remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: transparent;
    border: none;
    color: rgba(80, 70, 60, 0.4);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s, transform 0.1s;
    padding: 0;
    line-height: 1;
    z-index: 5;
}

.shelf-remove-btn:hover {
    color: #b38b4a;
    transform: scale(1.1);
}

/* ===== МОЁ МНЕНИЕ НА ПОЛКЕ (КЛИКАБЕЛЬНО) ===== */
.review-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
    transition: color 0.2s;
}

.review-toggle:hover {
    color: var(--gold);
}

.review-header {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.has-review-icon {
    color: var(--gold);
    font-size: 0.9rem;
}

/* ===== МОДАЛКА ОТЗЫВА ===== */
.review-modal-content {
    max-width: 600px;
}

.review-book-info {
    background: var(--bg-alt);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-style: italic;
    border-left: 4px solid var(--gold);
}

/* ===== ФОРМА ДОБАВЛЕНИЯ КНИГИ ===== */
.add-book {
    padding: 80px 0;
    background-color: var(--bg-alt);
}

.add-book__form {
    max-width: 700px;
    margin: 0 auto;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
    font-family: var(--font-serif);
    font-size: 1.1rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 1rem;
    background: var(--bg);
    transition: border 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(182,139,64,0.1);
}

/* ===== МОДАЛЬНЫЕ ОКНА (общие) ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.2);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    position: relative;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2.2rem;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--gold);
}

/* ===== КНОПКИ ===== */
.btn {
    display: inline-block;
    padding: 14px 40px;
    background-color: var(--accent);
    color: white;
    border-radius: 40px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
    border: 1px solid transparent;
    cursor: pointer;
    border: none;
}

.btn--primary {
    background-color: var(--accent);
}

.btn--primary:hover {
    background-color: var(--accent-light);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(30,42,71,0.1);
}

.btn--outline {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--accent);
}

.btn--outline:hover {
    background: var(--gold);
    color: white;
}

/* ===== ФУТЕР ===== */
.footer {
    padding: 40px 0;
    background-color: var(--accent);
    color: white;
    margin-top: 80px;
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* на случай узких экранов */
    gap: 20px;
}

.footer__copy {
    opacity: 0.9;
    font-size: 0.95rem;
}

.footer__social {
    display: flex;
    align-items: center;
    gap: 20px;
}

.footer__social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    transition: background 0.3s;
    color: white;
    font-size: 1.2rem;
}

.footer__social a:hover {
    background: var(--gold);
}

/* ===== КНОПКИ ЯНДЕКС ДИСКА ===== */
.footer__yandex {
    display: flex;
    gap: 10px;
}

.btn--yandex {
    background: transparent;
    border: 1px solid var(--gold);
    color: white;
    border-radius: 30px;
    padding: 6px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-serif);
    line-height: 1.5;
    height: 36px;               /* как у иконок */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn--yandex:hover {
    background: var(--gold);
    color: var(--accent);
    border-color: var(--gold);
    transform: translateY(-2px);
}

/* ===== ЛОАДЕР: ДЫМЯЩАЯСЯ ЧАШКА ЧАЯ ===== */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(253, 250, 247, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s;
}

#loader.active {
    visibility: visible;
    opacity: 1;
}

.tea-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.cup {
    position: relative;
    font-size: 4rem;
    color: var(--gold);
    animation: wobble 2s infinite ease-in-out;
}

.steam {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.steam span {
    display: block;
    width: 8px;
    height: 20px;
    background: rgba(182, 139, 64, 0.3);
    border-radius: 10px;
    animation: steam 1.5s infinite;
}

.steam span:nth-child(1) {
    animation-delay: 0.2s;
    height: 25px;
}

.steam span:nth-child(2) {
    animation-delay: 0.6s;
    height: 30px;
}

.steam span:nth-child(3) {
    animation-delay: 0.4s;
    height: 22px;
}

@keyframes steam {
    0% {
        opacity: 0;
        transform: translateY(0) scaleX(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-15px) scaleX(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scaleX(0.8);
    }
}

@keyframes wobble {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

/* ===== ПАГИНАЦИЯ ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
    font-family: var(--font-serif);
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover {
    background: var(--gold-light);
    border-color: var(--gold);
    color: var(--accent);
}

.pagination-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.pagination-dots {
    color: var(--text-light);
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin: 0 4px;
}

/* ===== МНОЖЕСТВЕННЫЕ ЦИТАТЫ ===== */
.book-card__quotes {
    margin: 16px 0;
    padding: 0;
}

.quotes-list {
    margin-bottom: 10px;
}

.quote-item {
    font-style: italic;
    margin-bottom: 8px;
    padding-left: 8px;
    border-left: 2px solid var(--gold-light);
}

.quote-more {
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 5px;
}

.quotes-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-light);
    opacity: 0.3;
    font-size: 0.8rem;
    padding: 2px 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
    color: var(--gold);
}

.quote-count {
    font-size: 0.85rem;
    font-weight: 500;
    color: inherit;
}

.quotes-list-container {
    max-height: 300px;
    overflow-y: auto;
    margin: 20px 0;
}

.quotes-list-full {
    list-style: none;
}

.quote-full-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.quote-full-text {
    font-style: italic;
    flex: 1;
    margin-right: 15px;
}

.empty-quotes {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* ===== ПАНЕЛЬ ПОИСКА И ФИЛЬТРОВ ===== */
.search-panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 30px;
}

.search-row {
    margin-bottom: 15px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 15px;
    color: var(--text-light);
    font-size: 1rem;
}

.search-input {
    padding-left: 45px !important;
    padding-right: 45px !important;
}

.btn-clear {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.btn-clear:hover {
    opacity: 1;
    color: var(--gold);
}

.filters-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.filter-select {
    flex: 1;
    min-width: 150px;
    background-color: var(--bg);
}

.btn-filter-fav {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 20px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-filter-fav.active {
    background: var(--gold-light);
    border-color: var(--gold);
    color: var(--accent);
}

.btn-filter-fav:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.sort-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.sort-label {
    color: var(--text-light);
    font-size: 0.9rem;
    white-space: nowrap;
}

.sort-select {
    width: auto;
    min-width: 180px;
    background-color: var(--bg);
}

.btn-sort-order {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-sort-order:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* Пустые состояния */
.empty-favorites, .empty-shelf {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-style: italic;
    font-size: 1.2rem;
    background: var(--bg-alt);
    border-radius: 12px;
    margin: 20px 0;
}

/* Увеличиваем правый отступ у всех select, чтобы стрелка не налезала */
.filter-select,
.sort-select,
.form-control select {
    padding-right: 35px !important;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f5b58' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.filter-select::-ms-expand,
.sort-select::-ms-expand {
    display: none;
}

/* Обложка: автор */
.cover-author {
    font-size: 0.9rem !important;
    margin-top: 8px;
    font-style: italic;
    opacity: 0.9;
    word-break: break-word;
    max-width: 100%;
    line-height: 1.3;
}

/* Пагинация внутри сетки книг */
.books__grid .pagination {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 40px;
}