/*
Theme Name: Bookshop Simple
Author: Bookshop
Description: Einfaches Buchhandlungs-Theme mit Kategorien, Buchdetails und Warenkorb.
Version: 1.0.0
Requires at least: 5.0
Requires PHP: 7.0
Text Domain: bookshop-simple
*/

:root {
    --ink: #1a1d23;
    --muted: #6b7280;
    --line: #e5e7eb;
    --paper: #f7f8fa;
    --white: #fff;
    --accent: #1d4ed8;
    --accent-dark: #1e3a8a;
    --sale: #dc2626;
    --ok: #16a34a;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--white);
    line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 40;
}
.header-top {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
}
.site-branding {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    text-decoration: none;
}
.site-branding:hover { text-decoration: none; }
.brand-logo {
    height: 54px;
    width: 54px;
    object-fit: contain;
    flex-shrink: 0;
}
.brand-name {
    font-size: 23px;
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.025em;
    color: var(--brand, var(--ink));
    max-width: 210px;
}

.header-search { flex: 1; max-width: 460px; }
.header-search form { display: flex; }
.header-search input[type="search"] {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 14px;
    outline: none;
}
.header-search input[type="search"]:focus { border-color: var(--accent); }
.header-search button {
    padding: 9px 18px;
    border: 0;
    background: var(--accent);
    color: #fff;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.header-search button:hover { background: var(--accent-dark); }

.cart-link {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}
.cart-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.cart-count {
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 700;
}

.main-nav { border-top: 1px solid var(--line); }
.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
}
.main-nav li a {
    display: block;
    padding: 11px 14px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
}
.main-nav li a:hover { color: var(--accent); text-decoration: none; }
.main-nav li.current-menu-item > a,
.main-nav li.current-cat > a { color: var(--accent); font-weight: 700; }

/* "Kategorien" dropdown for the categories that do not fit in the bar */
.main-nav li.has-dropdown { position: relative; }
.dropdown-toggle {
    display: block;
    padding: 11px 14px;
    border: 0;
    background: none;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}
.dropdown-toggle:hover { color: var(--accent); }
.dropdown-toggle .caret { font-size: 10px; opacity: .6; }
.main-nav .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 14px 34px rgba(15, 23, 42, .14);
    padding: 6px;
    z-index: 50;
    flex-direction: column;
    gap: 0;
}
.main-nav .has-dropdown.open .dropdown { display: flex; }
.main-nav .dropdown li a { padding: 9px 12px; border-radius: 8px; }
.main-nav .dropdown li a:hover { background: var(--paper); color: var(--accent); }

/* ---------- Page layout ---------- */
.site-main { padding: 32px 0 56px; }
.page-head { margin-bottom: 26px; }
.page-head h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
}
.page-head p { color: var(--muted); margin: 0; font-size: 15px; }

.notice {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 22px;
    font-size: 14px;
    font-weight: 500;
}
.notice-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.notice-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Book grid ---------- */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 26px 20px;
}
.book-card { display: flex; flex-direction: column; }
.book-card .cover {
    display: block;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    aspect-ratio: 3 / 4;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    position: relative;
}
.book-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}
.book-card .cover:hover { border-color: var(--accent); }
.cover-fallback { color: var(--muted); font-size: 13px; padding: 12px; text-align: center; }

.sale-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--sale);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}

.book-card h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
    line-height: 1.35;
}
.book-card h3 a { color: var(--ink); }
.book-card h3 a:hover { color: var(--accent); text-decoration: none; }
.book-card .author { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.book-card .author a { color: var(--muted); }
.book-card .price-row { margin-top: auto; display: flex; align-items: baseline; gap: 8px; }
.price { font-size: 16px; font-weight: 700; }
.price-old { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.price-sale { color: var(--sale); }

.btn {
    display: inline-block;
    padding: 10px 18px;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.btn-block { display: block; width: 100%; }
.btn-outline { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-outline:hover { background: var(--paper); color: var(--ink); border-color: var(--accent); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn[disabled], .btn:disabled { background: #cbd5e1; cursor: not-allowed; }
.book-card .btn { margin-top: 10px; }

/* ---------- Single book ---------- */
.book-single { display: grid; grid-template-columns: 320px 1fr; gap: 40px; }
.book-single .cover-box {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    padding: 18px;
    text-align: center;
    position: relative;
}
.book-single h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: -0.02em; }
.book-single .byline { color: var(--muted); font-size: 15px; margin: 0 0 18px; }
.book-single .price-block { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.book-single .price { font-size: 28px; }
.stock { font-size: 14px; margin-bottom: 20px; }
.stock.in { color: var(--ok); }
.stock.out { color: var(--sale); }

.add-to-cart-form { display: flex; gap: 10px; align-items: center; margin-bottom: 26px; }
.add-to-cart-form input[type="number"] {
    width: 76px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 14px;
}

.book-meta { border-top: 1px solid var(--line); padding-top: 20px; }
.book-meta table { width: 100%; border-collapse: collapse; font-size: 14px; }
.book-meta th, .book-meta td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); }
.book-meta th { color: var(--muted); font-weight: 500; width: 190px; }
.book-description { margin-top: 26px; font-size: 15px; }

/* ---------- Cart ---------- */
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 26px; }
.cart-table th, .cart-table td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
    vertical-align: middle;
}
.cart-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cart-table .cart-thumb { width: 60px; }
.cart-table .cart-thumb img { border-radius: 6px; border: 1px solid var(--line); }
.cart-table input[type="number"] {
    width: 68px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
}
.cart-remove { color: var(--sale); font-size: 13px; }
.cart-summary {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    max-width: 340px;
    margin-left: auto;
}
.cart-summary .row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 15px; }
.cart-summary .total { font-size: 20px; font-weight: 800; border-top: 1px solid var(--line); padding-top: 12px; }
.cart-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.cart-empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ---------- Pagination ---------- */
.pagination { margin-top: 40px; display: flex; justify-content: center; }
.pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font-size: 14px;
}
.pagination .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a.page-numbers:hover { border-color: var(--accent); text-decoration: none; }

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--line);
    background: var(--paper);
    padding: 40px 0 30px;
    margin-top: 40px;
}
.footer-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}
.footer-highlights a {
    display: block;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    color: var(--ink);
}
.footer-highlights a:hover { border-color: var(--accent); text-decoration: none; }
.footer-highlights strong { display: block; font-size: 15px; margin-bottom: 3px; }
.footer-highlights small { color: var(--muted); font-size: 13px; }

.footer-newsletter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
}
.footer-newsletter h3 { margin: 0 0 4px; font-size: 18px; }
.footer-newsletter p { margin: 0; color: var(--muted); font-size: 14px; }
.footer-newsletter form { display: flex; min-width: 300px; }
.footer-newsletter input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    font-size: 14px;
}
.footer-newsletter button {
    padding: 10px 20px;
    border: 0;
    background: var(--accent);
    color: #fff;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 30px;
    padding: 30px 0;
    border-bottom: 1px solid var(--line);
}
.footer-col h3 { font-size: 14px; margin: 0 0 12px; }
.footer-col h3 + nav + h3 { margin-top: 22px; }
.footer-col nav { display: flex; flex-direction: column; gap: 7px; }
.footer-col a { color: var(--muted); font-size: 13.5px; }
.footer-col a:hover { color: var(--accent); }

.footer-payments {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 22px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}
.payment-badge {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 20px;
    color: var(--muted);
    font-size: 13px;
}
.footer-legal { display: flex; gap: 16px; }
.footer-legal a { color: var(--muted); }
.footer-legal a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .book-single { grid-template-columns: 1fr; }
    .book-single .cover-box { max-width: 280px; }
    .header-top { flex-wrap: wrap; gap: 14px; }
    .header-search { order: 3; flex-basis: 100%; max-width: none; }
    .cart-summary { max-width: none; }
}
