﻿/* ============================================================
   store.css — หน้าร้านเอกสารการเรียน (/Store ฝั่งนักศึกษา)
   ------------------------------------------------------------
   ต่อยอดจาก achome-shop.css (การ์ด ปุ่ม แผง) — ที่นี่เฉพาะของร้านเอกสาร
   - การ์ดหนังสือแนวตั้ง (ปกหนังสือ 3:4) มือถือ 2 คอลัมน์ แท็บเล็ต 3–4 จอใหญ่ 5
   - ปกที่สร้างเองเมื่อไม่มีรูป : สีตามระดับ (ปวส. / ป.ตรี / ป.โท) + รหัสวิชา + ชื่อ
   - ช่องค้นหาใน hero · ชิประดับ · แถบตะกร้าลอยด้านล่าง (มือถือ/แท็บเล็ต)
   ============================================================ */

/* ---------- Hero ---------- */
.store-hero { position: relative; overflow: hidden; }
.store-hero::after {
    /* วงแสงจาง ๆ มุมขวา ให้ hero ไม่แบนเกินไป */
    content: "";
    position: absolute;
    right: -6rem;
    top: -6rem;
    width: 22rem;
    height: 22rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, .12), transparent 70%);
    pointer-events: none;
}
.store-hero > .container-xl { position: relative; z-index: 1; }

.store-hero-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }

.store-status {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .32rem .8rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
}
.store-status::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.store-status--open { background: rgba(74, 222, 128, .18); color: #bbf7d0; }
.store-status--closed { background: rgba(251, 191, 36, .18); color: #fde68a; }

.store-search {
    position: relative;
    display: flex;
    gap: .5rem;
    max-width: 640px;
    margin-top: 1.25rem;
    padding: .4rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(8, 30, 60, .25);
}
.store-search .bi-search { position: absolute; left: 1.15rem; top: 50%; transform: translateY(-50%); color: #7b8ba1; }
.store-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    padding: .55rem .5rem .55rem 2.4rem;
    font-size: 1rem;
    color: #10233d;
}
.store-search .shop-btn { border-radius: 999px; padding-inline: 1.2rem; }

/* ---------- ชิประดับ ---------- */
.store-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.1rem; }
.store-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 40px;
    padding: .4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--line, #dfe6ef);
    background: var(--surface, #fff);
    color: var(--ink-2, #34465e);
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.store-chip:hover { border-color: var(--brand-300, #8fb2dd); color: var(--brand-700, #123f75); }
.store-chip.is-active { background: var(--brand-600, #1c5aa6); border-color: var(--brand-600, #1c5aa6); color: #fff; }
.store-chip small { opacity: .75; font-weight: 400; }

/* ---------- ตารางหนังสือ ---------- */
.store-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
}
@media (min-width: 576px) { .store-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 900px) { .store-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.15rem; } }
@media (min-width: 1200px) { .store-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.store-book .shop-card-media { aspect-ratio: 3 / 4; }
.store-book .shop-card-body { padding: .75rem .8rem .85rem; }
.store-book .shop-card-title {
    font-size: .93rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.4em * 2);
}
.store-book .shop-card-desc { font-size: .8rem; margin-bottom: .65rem; -webkit-line-clamp: 2; }
.store-book .shop-card-foot { flex-direction: column; align-items: stretch; gap: .5rem; }
.store-book .shop-card-foot .shop-btn,
.store-book .shop-card-foot .shop-card-soldout { justify-content: center; width: 100%; }
.store-book .shop-price { font-size: 1.15rem; }

/* ปก "ส่งไปแล้ว / อยู่ในตะกร้า" : ป้ายมุมบนขวา (มุมซ้ายเป็นรหัสวิชาของปกที่สร้างเอง) */
.store-flag {
    position: absolute;
    right: .5rem;
    top: .5rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .22rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, .92);
    color: var(--brand-700, #123f75);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.store-flag--done { color: #15803d; }

/* ---------- ปกที่สร้างเอง (ไม่มีรูป) ---------- */
.store-gen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem .9rem;
    color: #fff;
    background: linear-gradient(150deg, var(--g1, #2b5fa8), var(--g2, #0c325d));
    overflow: hidden;
}
.store-gen::before {
    /* สันหนังสือ */
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 10px;
    background: rgba(0, 0, 0, .18);
}
.store-gen::after {
    /* วงกลมจาง ๆ มุมล่างขวา — ลายปก */
    content: "";
    position: absolute;
    right: -2.5rem;
    bottom: -2.5rem;
    width: 7.5rem;
    height: 7.5rem;
    border-radius: 50%;
    border: 14px solid rgba(255, 255, 255, .10);
}
.store-gen-code { font-size: .72rem; letter-spacing: .04em; opacity: .85; padding-left: .4rem; font-family: var(--font-num, inherit); }
.store-gen-title {
    padding-left: .4rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.store-gen-level {
    align-self: flex-start;
    margin-left: .4rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    font-size: .72rem;
}
.store-gen--D { --g1: #0f9f95; --g2: #075e59; }   /* ปวส. — เขียวอมฟ้า */
.store-gen--B { --g1: #2b6cc4; --g2: #0c325d; }   /* ป.ตรี — น้ำเงินคณะ */
.store-gen--M { --g1: #8b3f9e; --g2: #4b1d57; }   /* ป.โท — ม่วง */

/* ---------- แถบตะกร้าลอย (มือถือ/แท็บเล็ต) ---------- */
.store-cartbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 1040;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .8rem .7rem 1.1rem;
    border-radius: 16px;
    background: var(--brand-800, #0c325d);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(8, 30, 60, .35);
    animation: store-rise .25s ease-out;
}
.store-cartbar:hover { color: #fff; }
.store-cartbar .bi-basket2 { font-size: 1.35rem; }
.store-cartbar-text { flex: 1; line-height: 1.25; }
.store-cartbar-text small { display: block; opacity: .75; font-size: .78rem; }
.store-cartbar-go {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem .95rem;
    border-radius: 999px;
    background: #fff;
    color: var(--brand-800, #0c325d);
    font-weight: 700;
    font-size: .9rem;
}
@keyframes store-rise { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
/* มีแถบลอยแล้ว เว้นท้ายหน้าไม่ให้บังเนื้อหา และยก toast ขึ้นเหนือแถบ */
@media (max-width: 991.98px) {
    body:has(.store-cartbar) main { padding-bottom: 5.5rem; }
    body:has(.store-cartbar) .store-toasts { bottom: 92px; }
}
@media (min-width: 992px) { .store-cartbar { display: none; } }
@media (prefers-reduced-motion: reduce) { .store-cartbar { animation: none; } }

/* ลิงก์คู่มือใต้ปุ่มเข้าสู่ระบบบน hero */
.store-howto {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: .85rem;
    color: rgba(255, 255, 255, .88);
    font-size: .9rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.store-howto:hover, .store-howto:focus { color: #fff; }

/* เครดิตผู้พัฒนาท้ายหน้าร้าน */
.store-credit a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.store-credit a:hover { color: #fff; }
