/* ═══════════════════════════════════════════════════════════
   Kinderbuch CMS – Hauptstylesheet
   ═══════════════════════════════════════════════════════════ */

:root {
    --primary: #7c3aed;
    --primary-light: #a855f7;
    --primary-dark: #5b21b6;
    --secondary: #f59e0b;
    --accent: #ec4899;
    --bg: #faf5ff;
    --card: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --radius: 16px;
    --shadow: 0 4px 24px rgba(124,58,237,.12);
    --transition: .25s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ─── Topbar ──────────────────────────────────────────────── */
.topbar {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: .85rem;
    padding: 8px 0;
}
.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.cart-btn {
    background: rgba(255,255,255,.2);
    color: #fff;
    padding: 6px 16px;
    border-radius: 50px;
    font-weight: 700;
    position: relative;
    transition: background var(--transition);
    white-space: nowrap;
}
.cart-btn:hover { background: rgba(255,255,255,.35); color: #fff; }
.cart-badge {
    background: var(--secondary);
    color: #fff;
    font-size: .7rem;
    font-weight: 800;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    vertical-align: middle;
}

/* ─── Header ──────────────────────────────────────────────── */
.site-header {
    background: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,.08);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary);
    text-decoration: none;
}
.main-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}
.main-nav a {
    color: var(--text);
    font-weight: 700;
    font-size: .95rem;
    transition: color var(--transition);
}
.main-nav a:hover { color: var(--primary); }
.burger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

/* ─── Slider ──────────────────────────────────────────────── */
.slider-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 0 0 30px 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
}
.slider { position: relative; height: 480px; background: linear-gradient(135deg,#f0e6ff,#fce4f5); }
.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .7s ease;
}
.slide.active { opacity: 1; }
.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.slide-caption {
    position: absolute;
    bottom: 40px;
    left: 50px;
    background: rgba(0,0,0,.55);
    color: #fff;
    padding: 16px 28px;
    border-radius: 12px;
    backdrop-filter: blur(6px);
}
.slide-caption h2 { font-size: 1.8rem; font-weight: 800; }
.slide-prev, .slide-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.85);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.slide-prev { left: 20px; }
.slide-next { right: 20px; }
.slide-prev:hover, .slide-next:hover { background: var(--primary); color: #fff; }
.slide-dots {
    position: absolute;
    bottom: 16px;
    right: 24px;
    display: flex;
    gap: 8px;
}
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,.5);
    cursor: pointer;
    transition: all var(--transition);
}
.dot.active { background: #fff; transform: scale(1.3); }

.hero-fallback {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    text-align: center;
    padding: 80px 20px;
}
.hero-fallback h1 { font-size: 2.5rem; margin-bottom: 12px; }

/* ─── Main Content ────────────────────────────────────────── */
.main-content { padding: 50px 0 70px; }

/* ─── Section Titles ──────────────────────────────────────── */
.section-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 8px;
}
.section-sub {
    color: var(--text-light);
    margin-bottom: 40px;
    font-size: 1.05rem;
}

/* ─── Product Grid ────────────────────────────────────────── */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}
.product-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(124,58,237,.2);
}
.product-card .img-wrap {
    background: #f9f7ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    padding: 16px;
    min-height: 220px;
}
.product-card .img-wrap img {
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: contain;
    transition: transform .4s;
    image-rendering: -webkit-optimize-contrast;
}
.product-card:hover .img-wrap img { transform: scale(1.05); }
.product-card .card-body { padding: 20px; }
.product-card h3 { font-size: 1.1rem; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.product-card p { font-size: .88rem; color: var(--text-light); margin-bottom: 14px; }
.product-card .price { font-size: 1.2rem; font-weight: 900; color: var(--primary); display:block; margin-top:10px; }
.product-card .price-chf { font-size: .9rem; color: var(--text-light); display:block; margin-top:4px; }
.btn {
    display: inline-block;
    padding: 10px 22px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-radius: 50px;
    font-weight: 800;
    font-size: .9rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124,58,237,.4);
    color: #fff;
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-secondary { background: linear-gradient(135deg, var(--secondary), #f97316); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ─── Product Detail ──────────────────────────────────────── */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.product-gallery .main-img {
    border-radius: var(--radius);
    overflow: hidden;
    background: #f9f7ff;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.product-gallery .main-img img { width: 100%; height: auto; max-height: 480px; object-fit: contain; border-radius: 8px; display: block; }
.thumb-row { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb-row img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border var(--transition);
}
.thumb-row img.active { border-color: var(--primary); }
.product-info h1 { font-size: 1.8rem; font-weight: 900; margin-bottom: 12px; }
.product-price { font-size: 2rem; font-weight: 900; color: var(--primary); margin-bottom: 8px; }
.product-price-chf { color: var(--text-light); font-size: 1rem; margin-bottom: 20px; }
.product-desc { color: var(--text); line-height: 1.8; margin-bottom: 28px; }
.product-desc img { max-width: 100%; border-radius: 12px; margin: 12px 0; }

/* ─── Warenkorb ───────────────────────────────────────────── */
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
.cart-table th { text-align: left; padding: 12px 16px; background: var(--primary); color: #fff; }
.cart-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cart-table td img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.cart-total-box {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    max-width: 360px;
    margin-left: auto;
}
.cart-total-row { display: flex; justify-content: space-between; padding: 6px 0; }
.cart-total-row.final { font-weight: 800; font-size: 1.2rem; border-top: 2px solid var(--border); padding-top: 12px; margin-top: 6px; }

/* Währungswähler */
.currency-select { display: flex; gap: 10px; margin-bottom: 20px; }
.currency-btn {
    padding: 8px 20px;
    border-radius: 50px;
    border: 2px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.currency-btn.active { background: var(--primary); color: #fff; }

/* ─── Bestellformular Modal ───────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--card);
    border-radius: 24px;
    padding: 36px;
    max-width: 780px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,.3);
    animation: modalIn .3s ease;
}
@keyframes modalIn { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal h2 { color: var(--primary); font-size: 1.5rem; margin-bottom: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-weight: 700; font-size: .85rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .3px; }
.form-group input,
.form-group select,
.form-group textarea {
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: .95rem;
    font-family: inherit;
    transition: border var(--transition);
    background: #fafafa;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
}
.form-group textarea { min-height: 90px; resize: vertical; }
.form-section {
    background: #f8f4ff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}
.form-section h3 { color: var(--primary); font-size: 1rem; margin-bottom: 16px; }
.modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    margin-top: -8px;
}
.date-selects { display: flex; gap: 8px; }
.date-selects select { flex: 1; }

/* ─── CMS Seiten ──────────────────────────────────────────── */
.page-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
    line-height: 1.8;
}
.page-content h1,h2,h3 { color: var(--primary); margin: 20px 0 10px; }
.page-content p { margin-bottom: 14px; }

/* ─── Alerts ──────────────────────────────────────────────── */
.alert {
    padding: 14px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 600;
}
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #dc2626; }
.alert-info { background: #dbeafe; color: #1d4ed8; }


/* ─── Sonderpreis / Sale ──────────────────────────────────── */
.sale-badge {
    display: inline-block;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: #fff;
    font-size: .78rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .5px;
    box-shadow: 0 2px 8px rgba(220,38,38,.3);
    animation: salePulse 2s ease-in-out infinite;
}
@keyframes salePulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(220,38,38,.3); }
    50% { box-shadow: 0 4px 16px rgba(220,38,38,.5); }
}
.product-card .sale-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 5;
}
.price-old {
    text-decoration: line-through;
    color: var(--text-light);
    font-weight: 600;
    font-size: .9em;
}
.price-sale {
    color: #dc2626;
    font-weight: 900;
}
.product-card .img-wrap {
    position: relative;
}

/* ─── Footer ──────────────────────────────────────────────── */
.site-footer {
    background: #1a0533;
    color: rgba(255,255,255,.7);
    padding: 50px 0 0;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    padding-bottom: 40px;
    flex-wrap: wrap;
}
.footer-brand .logo { color: #fff; font-size: 1.3rem; }
.footer-brand p { margin-top: 10px; font-size: .9rem; max-width: 280px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: rgba(255,255,255,.7); font-size: .9rem; transition: color var(--transition); }
.footer-links a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    text-align: center;
    padding: 16px;
    font-size: .85rem;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        padding: 20px;
        box-shadow: 0 8px 20px rgba(0,0,0,.1);
    }
    .main-nav.open { display: flex; }
    .burger { display: block; }
    .site-header { position: relative; }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .product-detail { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .slider { height: 260px; }
    .slide-caption h2 { font-size: 1.2rem; }
    .slide-caption { left: 16px; bottom: 20px; padding: 10px 16px; }
    .topbar span { display: none; }
    .modal { padding: 24px; }
}

@media (max-width: 480px) {
    .product-grid { grid-template-columns: 1fr; }
}
