﻿:root {
    --book-bg: #f6f1e7;
    --book-paper: #fffdf8;
    --book-paper-alt: #f8f2e6;
    --book-ink: #1e1711;
    --book-muted: #695847;
    --book-gold: #d2a43f;
    --book-gold-dark: #9d7a2f;
    --book-edge: #e8dcc9;
    --book-shadow: rgba(29, 18, 8, 0.28);
    --book-accent: #5f4634;
    --book-line: rgba(95, 70, 52, 0.2);
}

body.book-layout {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 10%, rgba(210, 164, 63, 0.18), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(95, 70, 52, 0.12), transparent 34%),
        linear-gradient(140deg, #f6f1e7 0%, #ede1cf 52%, #f9f3ea 100%);
    color: var(--book-ink);
}

body.book-layout::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        130deg,
        rgba(255, 255, 255, 0.05),
        rgba(255, 255, 255, 0.05) 18px,
        rgba(220, 206, 188, 0.05) 18px,
        rgba(220, 206, 188, 0.05) 36px
    );
    z-index: -1;
}

.book-hero {
    margin-top: 80px;
    padding: 5.5rem 0 3.4rem;
}

.book-hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2rem;
    align-items: stretch;
}

.book-chip {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(157, 122, 47, 0.45);
    background: rgba(210, 164, 63, 0.14);
    color: var(--book-gold-dark);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

.book-hero h1 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.2rem, 4.2vw, 4.2rem);
    line-height: 1.04;
    color: var(--book-ink);
}

.book-hero h1 span {
    color: var(--book-gold-dark);
    font-style: italic;
}

.book-hero p {
    margin: 1.2rem 0 0;
    max-width: 56ch;
    color: var(--book-muted);
    line-height: 1.85;
    font-size: 1.02rem;
}

.book-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
    margin-top: 1.85rem;
}

.book-btn {
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.55rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.book-btn.primary {
    background: linear-gradient(135deg, var(--book-gold-dark), var(--book-gold));
    color: #140f0a;
    box-shadow: 0 11px 28px rgba(157, 122, 47, 0.28);
}

.book-btn.secondary {
    background: #1f1711;
    color: #fff7ee;
    box-shadow: 0 10px 24px rgba(16, 10, 4, 0.22);
}

.book-btn.ghost {
    background: transparent;
    border: 2px solid rgba(30, 23, 17, 0.26);
    color: var(--book-ink);
}

.book-btn:hover {
    transform: translateY(-2px);
}

.book-btn.primary:hover {
    box-shadow: 0 14px 32px rgba(157, 122, 47, 0.35);
}

.book-btn.secondary:hover {
    box-shadow: 0 14px 32px rgba(16, 10, 4, 0.3);
}

.book-btn.ghost:hover {
    border-color: rgba(30, 23, 17, 0.45);
    background: rgba(255, 255, 255, 0.45);
}

.book-hero-panel {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    padding: 1.8rem;
    border: 1px solid rgba(95, 70, 52, 0.2);
    background: linear-gradient(165deg, rgba(255, 253, 248, 0.97), rgba(245, 237, 224, 0.88));
    box-shadow: 0 20px 45px rgba(32, 19, 9, 0.15);
}

.book-hero-panel::after {
    content: '';
    position: absolute;
    width: 180px;
    height: 180px;
    right: -40px;
    top: -60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(210, 164, 63, 0.22) 0%, rgba(210, 164, 63, 0) 70%);
}

.book-stat-grid {
    display: grid;
    gap: 0.75rem;
}

.book-stat {
    position: relative;
    z-index: 1;
    border-radius: 14px;
    border: 1px solid rgba(95, 70, 52, 0.16);
    background: rgba(255, 255, 255, 0.8);
    padding: 0.95rem 1rem;
}

.book-stat strong {
    display: block;
    color: var(--book-gold-dark);
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
    font-family: 'Playfair Display', serif;
}

.book-stat span {
    color: var(--book-muted);
    font-size: 0.93rem;
}

.book-reader {
    margin-top: 96px;
    padding: 1.5rem 0 3.5rem;
}

.book-simple-title {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.7rem, 2.4vw, 2.35rem);
    color: var(--book-ink);
    letter-spacing: 0.01em;
}

.book-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    margin-bottom: 1.1rem;
    flex-wrap: wrap;
}

.book-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.book-toolbar-group {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

.book-toolbar input,
.book-toolbar select {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(95, 70, 52, 0.26);
    border-radius: 999px;
    padding: 0.7rem 1.05rem;
    min-width: 190px;
    color: var(--book-ink);
    font-family: 'Montserrat', sans-serif;
}

.book-toolbar input:focus,
.book-toolbar select:focus {
    outline: none;
    border-color: rgba(157, 122, 47, 0.65);
    box-shadow: 0 0 0 3px rgba(210, 164, 63, 0.18);
}

.book-status {
    color: var(--book-muted);
    font-size: 0.92rem;
}

.book-stage {
    position: relative;
    margin-top: 1rem;
}

.book-shell {
    position: relative;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(236, 222, 198, 0.78), rgba(211, 190, 156, 0.68));
    padding: 1.35rem;
    box-shadow: 0 22px 42px rgba(40, 22, 6, 0.22);
    perspective: 1800px;
    touch-action: pan-y;
    cursor: grab;
    user-select: none;
}

.book-spread {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 650px;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(95, 70, 52, 0.25);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
    transition: transform 240ms ease, box-shadow 240ms ease;
    transform-style: preserve-3d;
}

.book-spread::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: clamp(54px, calc(var(--curl-progress, 0) * 24%), 190px);
    opacity: 0;
    pointer-events: none;
    z-index: 4;
    transition: opacity 160ms ease;
}

.book-shell:active {
    cursor: grabbing;
}

.book-shell.dragging .book-spread {
    transition: none;
}

.book-shell.turning .book-spread {
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.38),
        0 20px 36px rgba(30, 16, 6, 0.28);
}

.book-shell.drag-next .book-spread::after,
.book-shell.turn-next .book-spread::after {
    right: 0;
    opacity: calc(0.14 + (var(--curl-progress, 0) * 0.72));
    background:
        linear-gradient(
            270deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(245, 233, 212, 0.9) 42%,
            rgba(176, 142, 96, 0.26) 70%,
            rgba(24, 14, 8, 0) 100%
        );
    box-shadow: -24px 0 26px rgba(43, 25, 10, 0.28);
    transform-origin: right center;
    transform: perspective(1700px) rotateY(calc(var(--curl-progress, 0) * -42deg));
}

.book-shell.drag-prev .book-spread::after,
.book-shell.turn-prev .book-spread::after {
    left: 0;
    opacity: calc(0.14 + (var(--curl-progress, 0) * 0.72));
    background:
        linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(245, 233, 212, 0.9) 42%,
            rgba(176, 142, 96, 0.26) 70%,
            rgba(24, 14, 8, 0) 100%
        );
    box-shadow: 24px 0 26px rgba(43, 25, 10, 0.28);
    transform-origin: left center;
    transform: perspective(1700px) rotateY(calc(var(--curl-progress, 0) * 42deg));
}

.book-shell.turn-next .book-spread {
    animation: pageTurnNext 440ms cubic-bezier(0.2, 0.7, 0.16, 1);
}

.book-shell.turn-prev .book-spread {
    animation: pageTurnPrev 440ms cubic-bezier(0.2, 0.7, 0.16, 1);
}

@keyframes pageTurnNext {
    0% { transform: perspective(1800px) rotateY(0deg) translateX(0); }
    45% { transform: perspective(1800px) rotateY(-11deg) translateX(-10px) skewY(-0.7deg); }
    100% { transform: perspective(1800px) rotateY(0deg) translateX(0); }
}

@keyframes pageTurnPrev {
    0% { transform: perspective(1800px) rotateY(0deg) translateX(0); }
    45% { transform: perspective(1800px) rotateY(11deg) translateX(10px) skewY(0.7deg); }
    100% { transform: perspective(1800px) rotateY(0deg) translateX(0); }
}

.book-spread::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 42px;
    height: 100%;
    background:
        linear-gradient(90deg, rgba(49, 32, 18, 0.28), rgba(49, 32, 18, 0.04) 44%, rgba(255, 255, 255, 0.36) 50%, rgba(49, 32, 18, 0.04) 56%, rgba(49, 32, 18, 0.28));
    pointer-events: none;
    z-index: 3;
}

.book-page {
    position: relative;
    padding: 2.2rem 2rem 2.8rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: linear-gradient(180deg, var(--book-paper) 0%, #f8f2e5 100%);
}

.book-page.right {
    background: linear-gradient(180deg, #fffefa 0%, #f4ecdd 100%);
}

.page-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--book-muted);
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.page-label strong {
    color: var(--book-gold-dark);
    font-weight: 700;
}

.page-course-list {
    display: grid;
    gap: 1rem;
}

.book-course-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(95, 70, 52, 0.19);
    border-radius: 14px;
    padding: 0.8rem;
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 0.85rem;
    align-items: stretch;
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.book-course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 22px rgba(34, 20, 8, 0.16);
}

.book-course-image {
    width: 88px;
    height: 88px;
    border-radius: 10px;
    overflow: hidden;
    background: #ebdcc2;
}

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

.book-course-body h3 {
    margin: 0 0 0.35rem;
    font-size: 1.01rem;
    line-height: 1.35;
    color: var(--book-ink);
    font-weight: 700;
}

.book-course-body {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.book-course-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.55rem;
}

.book-info-item {
    border: 1px solid rgba(95, 70, 52, 0.15);
    border-radius: 8px;
    background: rgba(245, 237, 224, 0.72);
    padding: 0.34rem 0.5rem;
}

.book-info-item span {
    display: block;
    font-size: 0.66rem;
    color: #6f5b47;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.12rem;
}

.book-info-item strong {
    font-size: 0.79rem;
    color: #22170e;
    font-weight: 700;
}

.book-course-desc {
    margin: 0;
    color: #534234;
    font-size: 0.89rem;
    line-height: 1.63;
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-course-footer {
    margin-top: 0.55rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
}

.book-price {
    color: #23160d;
    font-weight: 700;
    font-size: 0.91rem;
}

.book-page-empty {
    margin: auto 0;
    border: 1px dashed rgba(95, 70, 52, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    color: #63513f;
    background: rgba(255, 255, 255, 0.64);
}

.book-gesture-row {
    margin-top: 1rem;
    display: grid;
    gap: 0.35rem;
    justify-items: center;
}

.book-indicator {
    font-weight: 600;
    color: #4e3b2d;
    min-width: 170px;
    text-align: center;
}

.book-gesture-hint {
    color: #6a5644;
    font-size: 0.87rem;
    text-align: center;
}

.book-drag-action {
    color: #2e2116;
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(255, 250, 241, 0.88);
    border: 1px solid rgba(95, 70, 52, 0.25);
    border-radius: 999px;
    padding: 0.28rem 0.75rem;
}

.book-drag-action.hidden {
    display: none;
}

.book-empty {
    margin-top: 1.1rem;
    border: 1px dashed rgba(95, 70, 52, 0.4);
    border-radius: 14px;
    padding: 1.5rem;
    text-align: center;
    color: #5f4b39;
    background: rgba(255, 255, 255, 0.7);
}

.book-empty.hidden {
    display: none;
}

.book-note {
    margin-top: 1rem;
    color: #5d4938;
    font-size: 0.92rem;
    text-align: center;
}

.print-catalogue {
    display: none;
    margin: 0;
    padding: 0;
}

.print-sheet {
    page-break-after: always;
    padding: 0.9cm;
    border: 1px solid #d2c2ab;
    border-radius: 12px;
    margin-bottom: 0.5cm;
    background: #fff;
}

.print-sheet:last-child {
    page-break-after: auto;
}

.print-header {
    border-bottom: 2px solid #8b6c2f;
    padding-bottom: 0.28cm;
    margin-bottom: 0.35cm;
}

.print-header h2 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: 20pt;
    color: #20160f;
}

.print-meta {
    margin-top: 0.18cm;
    color: #5c4a39;
    font-size: 9.5pt;
}

.print-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.32cm;
}

.print-card {
    border: 1px solid #d8cab4;
    border-left: 5px solid #9d7a2f;
    border-radius: 10px;
    padding: 0.26cm 0.28cm;
    break-inside: avoid;
    background: #fffdf9;
}

.print-card-head {
    display: grid;
    grid-template-columns: 2.6cm 1fr;
    gap: 0.25cm;
    align-items: start;
}

.print-card-image-wrap {
    width: 2.6cm;
    height: 2.2cm;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #deceb6;
    background: #f2e5d1;
}

.print-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.print-card-content h3 {
    margin: 0 0 0.12cm;
    font-size: 12pt;
    color: #1d140e;
}

.print-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.1cm 0.26cm;
    margin-bottom: 0.12cm;
}

.print-inline {
    margin: 0;
    border: 1px solid #e3d5c0;
    border-radius: 6px;
    background: #fdf7ed;
    padding: 0.08cm 0.12cm;
    font-size: 8.6pt;
    color: #3f2f22;
}

.print-inline span {
    display: inline-block;
    color: #71573f;
    margin-right: 0.15cm;
}

.print-inline strong {
    color: #21160f;
}

.print-inline-full {
    grid-column: 1 / -1;
}

.print-desc {
    margin: 0.14cm 0 0;
    font-size: 9pt;
    color: #433324;
    line-height: 1.48;
    white-space: pre-line;
}

@media (max-width: 1150px) {
    .book-hero-grid {
        grid-template-columns: 1fr;
    }

    .book-hero-panel {
        max-width: 620px;
    }
}

@media (max-width: 980px) {
    .book-shell {
        padding: 1rem;
    }

    .book-spread {
        grid-template-columns: 1fr;
        min-height: unset;
    }

    .book-spread::before {
        display: none;
    }

    .book-page {
        padding: 1.65rem 1.2rem 2rem;
    }

    .book-page.right {
        border-top: 1px dashed rgba(95, 70, 52, 0.25);
    }
}

@media (max-width: 620px) {
    .book-reader {
        margin-top: 82px;
        padding-top: 1rem;
    }

    .book-toolbar input,
    .book-toolbar select {
        min-width: 100%;
    }

    .book-toolbar-group {
        width: 100%;
    }

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

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

    .book-course-image {
        width: 100%;
        height: 150px;
    }

    .book-indicator {
        width: 100%;
    }

    .book-title-row .book-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

@media print {
    @page {
        margin: 10mm;
    }

    body.book-layout {
        background: #fff;
    }

    body.book-layout::before {
        display: none;
    }

    .screen-only,
    .navbar,
    .footer,
    .chatbot-container,
    .chatbot-toggle {
        display: none !important;
    }

    .print-catalogue {
        display: block !important;
    }

    .print-sheet:first-child {
        page-break-before: avoid;
    }
}

body.book-layout.book-print-mode {
    background: #fff;
}

body.book-layout.book-print-mode::before {
    display: none;
}

body.book-layout.book-print-mode .screen-only,
body.book-layout.book-print-mode .navbar,
body.book-layout.book-print-mode .footer,
body.book-layout.book-print-mode .chatbot-container,
body.book-layout.book-print-mode .chatbot-toggle {
    display: none !important;
}

body.book-layout.book-print-mode .print-catalogue {
    display: block !important;
}
