/* =========================================================
   FRIENDS VU BOOK SHOP — book.css (v3)
   Styled for current index.blade.php + partials/book-card
   Palette matches landing page (navy + orange).
   Want the old maroon/vintage look? Swap the 6 values
   marked with "maroon:" below.
   ========================================================= */

:root {
    --brand:       #13284A;   /* maroon: #7C2333 */
    --brand-dark:  #0D1D38;   /* maroon: #5E1A27 */
    --brand-soft:  #EDF1F7;   /* maroon: #F2F0E7 */
    --accent:      #F2932B;   /* maroon: #D9A441 */
    --accent-soft: #FDECD2;   /* maroon: #F1D9A6 */
    --paper:       #F7F9FC;   /* maroon: #EEEDE3 */
    --line:        #DCE3EC;   /* maroon: #C9C6B6 */

    --card:     #FFFFFF;
    --ink:      #13284A;
    --ink-soft: #4C6076;
    --green:    #1F7A4D;

    --shadow-sm: 0 2px 8px rgba(19,40,74,.06);
    --shadow-md: 0 8px 24px rgba(19,40,74,.10);
    --shadow-lg: 0 16px 40px rgba(19,40,74,.14);
    --radius: 14px;
}

/* ===== RESET ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* ===== HEADER ===== */
header {
    background: var(--card);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}
.header-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* logo is now an <a> with .logo-mark + .logo-text */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-mark {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    border-radius: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    box-shadow: 3px 3px 0 var(--accent);
    transition: transform .25s ease;
}
.logo:hover .logo-mark { transform: rotate(-4deg); }
.logo-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--ink);
    white-space: nowrap;
}

nav { display: flex; align-items: center; gap: 6px; }
nav a {
    padding: 9px 14px;
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
    transition: background .2s, color .2s;
}
nav a:hover { background: var(--brand-soft); color: var(--ink); }
nav a.active { background: var(--accent-soft); color: #B45309; font-weight: 700; }

/* ===== CART PILL — always visible now, even on mobile ===== */
.header-right { display: flex; align-items: center; }
.cart-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--brand);
    color: #fff;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .2s, transform .2s, box-shadow .2s;
}
.cart-pill:hover {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(242,147,43,.35);
}

/* ===== SECTION HEAD ===== */
.section { padding: 52px 0 70px; }
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.section-head > div { min-width: 0; }
.tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    padding: 6px 12px;
    background: var(--accent-soft);
    color: #B45309;
    border-radius: 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.tag::before {
    content: '●';
    font-size: 8px;
    color: var(--accent);
    animation: pulse-dot 1.8s infinite;
}
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.section h2 {
    font-family: 'Zilla Slab', Georgia, serif;
    font-size: clamp(30px, 4vw, 42px);
    font-weight: 700;
    line-height: 1.1;
}

/* result-count chip next to heading */
.result-count {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    background: var(--card);
    border: 1px solid var(--line);
    padding: 8px 14px;
    border-radius: 8px;
    white-space: nowrap;
}

/* ===== SEARCH ===== */
.search-slip {
    width: 100%;
    max-width: 560px;
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 36px;
}
.label-row {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    color: var(--ink-soft);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
}
.label-row::before { content: '🔍'; font-size: 12px; }
.search-row { display: flex; gap: 10px; }
.search-row input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 16px;
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.search-row input::placeholder { color: #9AA3B2; }
.search-row input:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(242,147,43,.15);
}

/* ===== BUTTONS ===== */
.btn {
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    padding: 13px 22px;
    transition: background .2s, transform .2s, box-shadow .2s, color .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover {
    background: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.search-row .btn-primary { height: 48px; padding: 0 22px; }

/* PDF / Word small ghost links inside book-card */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--card);
    color: var(--brand);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-weight: 700;
    transition: background .2s, color .2s, border-color .2s;
}
.btn-ghost:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* ===== BOOK GRID ===== */
.book-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    align-items: stretch;
}

/* ===== BOOK CARD (matches partials/book-card.blade.php) ===== */
.book-card {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.book-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}

/* legacy span from old partial — keep hidden */
.book-card .hole { display: none; }

.book-cover{
    width:100%;
    height:auto;
    aspect-ratio:3/4;
    object-fit:cover;
    border-radius:var(--radius) var(--radius) 0 0;
    display:block;
}
.book-card:hover .book-cover { transform: scale(1.03); }

/* course-code chip — shows ONLY when there is no cover image */
.book-card .code {
    display: inline-block;
    width: fit-content;
    margin-bottom: 10px;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
}

.book-card h3 {
    font-family: 'Zilla Slab', Georgia, serif;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 10px;
    color: var(--ink);
    flex-grow: 0;
}

/* PDF / Word row (inline styles in partial handle gap/margin) */
.book-card .btn-ghost { font-weight: 700; }

/* price + add-to-cart row */
.book-card .price-row {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.book-card .price-row form { display: flex; margin: 0; }
.book-card .price {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
}

/* add-to-cart button */
.book-card .btn-add {
    margin-top: 0;                 /* override old generic button margin */
    height: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(19,40,74,.18);
}
.book-card .btn-add:hover {
    background: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(242,147,43,.35);
}
.book-card .btn-add:disabled { opacity: .7; cursor: wait; transform: none; }
.book-card .btn-add.is-added { background: var(--green); }

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 56px 24px;
    text-align: center;
    background: var(--card);
    border: 1.5px dashed var(--line);
    border-radius: var(--radius);
    color: var(--ink-soft);
}
.empty-state .icon { font-size: 2.4rem; }
.empty-state h3 {
    font-family: 'Zilla Slab', serif;
    color: var(--ink);
    font-size: 20px;
}
.empty-state p { font-size: 14px; max-width: 44ch; }
.empty-state .btn { margin-top: 8px; }

/* ===== PAGINATION ===== */
.pagination-wrap {
    display: flex;
    justify-content: center;
    margin-top: 45px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}
.pagination-wrap nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
}
.pagination-wrap nav > div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
}
.pagination-wrap nav a,
.pagination-wrap nav span {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
}
.pagination-wrap nav a:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.pagination-wrap nav span[aria-current="page"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 800;
}
.pagination-wrap nav span[aria-disabled="true"] {
    opacity: .45;
    cursor: not-allowed;
    background: var(--brand-soft);
}
.pagination-wrap nav svg { width: 17px; height: 17px; }

/* ===== TOAST (styled in case you use it later) ===== */
.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 200;
    transform: translate(-50%, 20px);
    background: var(--brand);
    color: #fff;
    padding: 13px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    max-width: calc(100% - 32px);
    text-align: center;
    transition: opacity .3s ease, transform .3s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.cart-count { font-family: 'IBM Plex Mono', monospace; }

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1024px) {
    .wrap { width: min(100% - 32px, 900px); }
    .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
    .book-card h3 { font-size: 18px; }
}

@media (max-width: 768px) {
    .header-inner {
        min-height: auto;
        padding: 14px 0;
        flex-wrap: wrap;
        gap: 14px;
    }
    nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto;
        border-top: 1px solid var(--line);
        padding-top: 10px;
    }
    nav a { white-space: nowrap; font-size: 13px; }

    .section { padding: 38px 0 55px; }
    .section h2 { font-size: 32px; }
    .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .book-card { padding: 14px; }
    .book-card h3 { font-size: 17px; }
    .book-card .btn-add { padding: 8px 13px; font-size: 12px; }
}

@media (max-width: 600px) {
    .wrap { width: calc(100% - 28px); }
    .logo-mark { width: 40px; height: 40px; font-size: 10px; }
    .logo-text { font-size: 10px; }
    .cart-pill { padding: 8px 14px; font-size: 12px; }

    .section { padding: 32px 0 45px; }
    .section h2 { font-size: 29px; }
    .search-slip { padding: 14px; margin-bottom: 26px; }

    /* cards become compact horizontal rows */
    .book-grid { grid-template-columns: 1fr; gap: 14px; }
    .book-card {
        display: grid;
        grid-template-columns: 104px 1fr;
        grid-template-rows: auto auto auto;
        gap: 4px 14px;
        align-items: center;
        padding: 12px;
    }
    .book-card .book-cover {
        grid-row: 1 / span 3;
        grid-column: 1;
        width: 100%;
        height: 100%;
        min-height: 148px;
        aspect-ratio: auto;
        margin-bottom: 0;
    }
    .book-card .code { grid-column: 1; grid-row: 1; margin: 0; justify-self: center; text-align: center; }
    .book-card h3 { grid-column: 2; margin-bottom: 4px; }
    .book-card .price-row { grid-column: 2; padding-top: 10px; }

    .pagination-wrap nav a,
    .pagination-wrap nav span { min-width: 36px; height: 36px; padding: 0 9px; font-size: 12px; }
}

@media (max-width: 400px) {
    .wrap { width: calc(100% - 20px); }
    .logo { gap: 8px; }
    .logo-text { font-size: 9px; }
    .logo-mark { width: 36px; height: 36px; font-size: 9px; box-shadow: 2px 2px 0 var(--accent); }
    nav a { padding: 8px 10px; font-size: 12px; }

    .section h2 { font-size: 25px; }
    .search-row { flex-direction: column; }
    .search-row input, .search-row .btn { width: 100%; }

    .book-card { grid-template-columns: 88px 1fr; padding: 10px; gap: 3px 12px; }
    .book-card .book-cover { min-height: 128px; }
    .book-card h3 { font-size: 15px; }
    .book-card .price { font-size: 15px; }
    .book-card .btn-add { width: 100%; justify-content: center; }
}

/* ===== TOUCH DEVICES ===== */
@media (hover: none) {
    .book-card:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--line); }
    .book-card:hover .book-cover { transform: none; }
    .book-card .btn-add:hover { transform: none; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}