/* ════════════════════════════════════════════════════════════════════
   SHIFTDECK · Responsive Foundation v6.43
   Globaler Polish-Layer für Mobile / Tablet / Desktop.
   Wird in jeder HTML-Seite via <link rel="stylesheet" href="/assets/sd-responsive.css"> eingebunden.
   ──────────────────────────────────────────────────────────────────────
   Standard-Breakpoints:
     XS   < 480px   kleines Smartphone
     SM   < 768px   großes Smartphone
     MD   < 1024px  Tablet
     LG   < 1280px  kleines Notebook
     XL   ≥ 1280px  Desktop
   ════════════════════════════════════════════════════════════════════ */

/* ─── Box-Sizing-Reset & Antialiasing ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
/* iOS-Auto-Zoom bei Input-Fokus unterbinden */
@supports (-webkit-touch-callout: none) {
    input, select, textarea { font-size: max(16px, 1em); }
}

/* ─── Bilder &amp; Media: nie horizontal überlaufen ─────────────────── */
img, video, iframe, svg, picture {
    max-width: 100%;
    height: auto;
}
img[loading] { background: #f1f5f9; }

/* ─── Tabellen mobile-friendly ─────────────────────────────────────── */
@media (max-width: 767px) {
    .sd-resp-table, table.sd-resp {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        white-space: nowrap;
    }
    .sd-resp-table::-webkit-scrollbar,
    table.sd-resp::-webkit-scrollbar { height: 6px; }
    .sd-resp-table::-webkit-scrollbar-thumb,
    table.sd-resp::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
}

/* ─── Touch-Targets: mindestens 44 × 44 px ─────────────────────────── */
@media (max-width: 1023px) {
    button, .btn, .nav-cta, input[type="submit"], input[type="button"],
    a.btn, .pay-card, .addon-card, .plan-card, .host-toggle-btn {
        min-height: 44px;
    }
    button:not([class*="btn-icon"]):not(.faq-arrow):not(.copy),
    .btn, a.btn, .nav-cta {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }
    /* Icon-only Buttons brauchen sichtbares Klickfeld */
    button[class*="btn-icon"], .btn-icon { min-width: 44px; min-height: 44px; }
}

/* ─── Hover-Styles nur auf Geräten mit echter Maus aktivieren ─────── */
@media (hover: none) {
    /* Hover-Animationen auf Touch deaktivieren — sie verursachen den "Stuck-Hover"-Bug */
    *:hover { transition: none !important; }
}

/* ─── Tap-Highlight schöner ────────────────────────────────────────── */
a, button, [role="button"], input, textarea, select, label {
    -webkit-tap-highlight-color: rgba(245, 184, 46, 0.18);
}

/* ─── iOS Smooth-Scroll ────────────────────────────────────────────── */
.sd-scrollable, [data-scroll], .live-list, .feed, body {
    -webkit-overflow-scrolling: touch;
}

/* ─── Schriftgrößen mit clamp() für Hero-Headlines ─────────────────── */
.sd-h1, h1.hero-h1, .hero h1 {
    font-size: clamp(1.75rem, 5.5vw, 3.4rem);
    line-height: 1.1;
    letter-spacing: -0.025em;
}
.sd-h2, .sec-title {
    font-size: clamp(1.4rem, 3.6vw, 2.4rem);
}

/* ─── Container-Padding bei kleinen Viewports ──────────────────────── */
@media (max-width: 480px) {
    .wrap, .container, [class*="max-w-"] { padding-left: 16px; padding-right: 16px; }
    .hero { padding-left: 18px !important; padding-right: 18px !important; }
}

/* ─── Card-Grids automatisch responsive ────────────────────────────── */
@media (max-width: 767px) {
    /* Multi-Spalten-Grids → 1 Spalte */
    .kpi-grid, .qa-grid, .card-grid, .fcs, .fc-grid, .servers-tbl tbody,
    .mh-gauges, .chart-row, .table-row, .row {
        grid-template-columns: 1fr !important;
    }
}
@media (min-width: 768px) and (max-width: 1023px) {
    /* Tablet: 2 Spalten */
    .kpi-grid, .qa-grid, .card-grid, .fcs, .fc-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ─── Sticky-Sidebars: auf Mobile keine fixed-Sidebar ─────────────── */
@media (max-width: 767px) {
    aside.sidebar, .sidebar:not(.sd-keep-sidebar) {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
    }
    /* Portal-Main bekommt vollen Platz */
    .portal-main, main.portal-main, main {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* ─── Modals auf Mobile vollbreit ──────────────────────────────────── */
@media (max-width: 600px) {
    .modal, .modal-bg .modal {
        max-width: 100% !important;
        width: 100% !important;
        margin: 8px !important;
        border-radius: 14px !important;
    }
    .modal-bg { padding: 8px !important; align-items: flex-start !important; }
    .modal-bg .modal { max-height: calc(100vh - 16px) !important; }
}

/* ─── Formular-Layouts ────────────────────────────────────────────── */
@media (max-width: 600px) {
    .form-row, .form-row.full {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }
    .fg input, .fg select, .fg textarea {
        font-size: 16px !important; /* iOS-Zoom verhindern */
    }
}

/* ─── Topbars auf Mobile kompakter ─────────────────────────────────── */
@media (max-width: 600px) {
    .topbar {
        padding: 10px 16px !important;
        flex-wrap: wrap;
        gap: 10px !important;
    }
    .topbar .crumbs { font-size: .76rem !important; }
    .topbar .btn-back { padding: 7px 10px !important; font-size: .74rem !important; }
}

/* ─── Buttons & CTAs auf Mobile vollbreit ──────────────────────────── */
@media (max-width: 480px) {
    .btn-primary, .btn-gold, .nav-cta {
        width: 100%;
        justify-content: center;
    }
    .fw-actions, .ctas, .final-cta-actions {
        flex-direction: column;
    }
    .fw-cta-primary, .fw-cta-ghost {
        width: 100% !important;
        justify-content: center;
    }
}

/* ─── Hero-Stats kompakter ─────────────────────────────────────────── */
@media (max-width: 600px) {
    .hero-stats {
        gap: 8px !important;
        padding: 12px !important;
        max-width: 100% !important;
    }
    .hero-stats .hs-n, .hero-stat .num { font-size: 1.3rem !important; }
}

/* ─── Mobile-Navigation (Hamburger) ────────────────────────────────── */
.sd-mobile-nav-toggle {
    display: none;
    width: 44px; height: 44px;
    align-items: center; justify-content: center;
    background: transparent; border: 0; cursor: pointer;
    color: inherit; padding: 0;
}
.sd-mobile-nav-toggle svg { width: 24px; height: 24px; }

@media (max-width: 767px) {
    .sd-mobile-nav-toggle { display: inline-flex; }
    /* Standard-Nav-Linkleiste ausblenden, wenn Hamburger aktiv */
    .sd-mobile-hidden { display: none !important; }
}

/* Slide-In-Drawer (von rechts) */
.sd-drawer {
    position: fixed;
    top: 0; right: -100%;
    width: min(320px, 88vw);
    height: 100vh;
    background: #fff;
    box-shadow: -16px 0 40px -8px rgba(15, 23, 42, .25);
    z-index: 1000;
    transition: right .28s cubic-bezier(.22, 1, .36, 1);
    overflow-y: auto;
    padding: 18px 22px;
    display: flex; flex-direction: column; gap: 6px;
}
.sd-drawer.open { right: 0; }
.sd-drawer-head {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 14px; border-bottom: 1px solid #e2e8f0; margin-bottom: 8px;
}
.sd-drawer-close {
    width: 36px; height: 36px;
    background: transparent; border: 0;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #64748b;
    border-radius: 8px;
}
.sd-drawer-close:hover { background: #f1f5f9; color: #0f172a; }
.sd-drawer a {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: #0f172a;
    font-weight: 700;
    font-size: .92rem;
    transition: .15s;
}
.sd-drawer a:hover, .sd-drawer a:focus { background: #f8fafc; color: #d97706; }
.sd-drawer-cta {
    margin-top: auto;
    padding: 12px 16px !important;
    background: linear-gradient(135deg, #f5b82e, #d97706);
    color: #1a1f2c !important;
    text-align: center;
    border-radius: 10px;
    font-weight: 900 !important;
    justify-content: center;
}
.sd-drawer-cta:hover { background: linear-gradient(135deg, #fbbf24, #c2410c); color: #1a1f2c !important; }
.sd-drawer-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 999;
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
}
.sd-drawer-overlay.open { opacity: 1; pointer-events: auto; }

/* ─── Mobile-Nav: feste Top-Bar bei kleinen Screens auf bestimmten Seiten ─ */
@media (max-width: 767px) {
    /* Fixed Brand + Hamburger im Kunden-Portal */
    .sd-mobile-topbar {
        display: flex; align-items: center; justify-content: space-between;
        position: sticky; top: 0; z-index: 50;
        background: #0f172a; color: #fff;
        padding: 12px 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
    }
}
@media (min-width: 768px) {
    .sd-mobile-topbar { display: none; }
}

/* ─── Newsletter / Pill-Reihen ─────────────────────────────────────── */
@media (max-width: 600px) {
    .pills { flex-wrap: wrap !important; gap: 6px !important; justify-content: center; }
    .pill { font-size: .72rem !important; padding: 5px 11px !important; }
}

/* ─── Charts (Chart.js Canvas) ─────────────────────────────────────── */
@media (max-width: 600px) {
    .chart-wrap, .mh-gauge-canvas {
        max-width: 100%;
        height: 220px !important;
    }
    .mh-gauge-canvas { width: 160px; height: 160px !important; margin: 0 auto; }
}

/* ─── Footer ───────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    footer .foot-grid, .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 28px !important;
        text-align: left;
    }
    footer { padding: 50px 18px 30px !important; }
}

/* ─── Print-Reset: nichts vom Responsive überschreibt Print-CSS ───── */
@media print {
    .sd-mobile-nav-toggle, .sd-drawer, .sd-drawer-overlay, .sd-mobile-topbar { display: none !important; }
}

/* ─── Utility-Klassen ──────────────────────────────────────────────── */
.sd-no-mobile { display: none; }
@media (min-width: 768px) { .sd-no-mobile { display: initial; } }
.sd-only-mobile { display: initial; }
@media (min-width: 768px) { .sd-only-mobile { display: none; } }
.sd-safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0); }
