/* ZepMed unified design system — shared across admin, seller, delivery panels */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
    --zm-teal: #0d9488;
    --zm-teal-dark: #0f766e;
    --zm-emerald: #059669;
    --zm-indigo: #6366f1;
    --zm-violet: #8b5cf6;
    --zm-sky: #0ea5e9;
    --zm-amber: #f59e0b;
    --zm-coral: #f97316;
    --zm-gradient: linear-gradient(135deg, #0f766e 0%, #059669 38%, #6366f1 100%);
    --zm-gradient-soft: linear-gradient(160deg, #ecfdf5 0%, #eef2ff 50%, #f0fdfa 100%);
    --zm-shadow: 0 8px 32px rgba(15, 118, 110, 0.12);
    --zm-shadow-lg: 0 20px 50px rgba(99, 102, 241, 0.15);
    --zm-radius: 14px;
    --zm-font: "Inter", "Segoe UI", system-ui, sans-serif;
    --zm-heading: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
    /* ── Layout ── */
    --zm-sidebar-width: 260px;
    /* ── Spacing — 4 px base grid ── */
    --zm-space-1:  4px;
    --zm-space-2:  8px;
    --zm-space-3:  12px;
    --zm-space-4:  16px;
    --zm-space-5:  20px;
    --zm-space-6:  24px;
    --zm-space-8:  32px;
    --zm-space-10: 40px;
    --zm-space-12: 48px;
    /* ── Named radius tokens ── */
    --zm-radius-sm:    8px;
    --zm-radius-card:  14px;
    --zm-radius-modal: 16px;
    --zm-radius-hero:  24px;
    /* ── Fine elevation ── */
    --zm-shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(13,148,136,0.06);
}

@keyframes zm-fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes zm-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes zm-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
}
@keyframes zm-pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(13, 148, 136, 0); }
}
@keyframes zm-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes zm-gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes zm-slide-in {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

.zepmed-app { font-family: var(--zm-font); }
.zepmed-app h1, .zepmed-app h2, .zepmed-app h3, .zepmed-app .topbar h2, .zepmed-app .card-head h6 {
    font-family: var(--zm-heading);
}
.zepmed-app .topbar h2 { font-weight: 800; }

.animate-fade-up { animation: zm-fade-up 0.55s ease-out both; }
.animate-fade-in { animation: zm-fade-in 0.4s ease-out both; }
.animate-float { animation: zm-float 5s ease-in-out infinite; }
.animate-pulse-glow { animation: zm-pulse-glow 2s ease-in-out infinite; }
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

.zm-hero-banner {
    position: relative;
    border-radius: var(--zm-radius);
    overflow: hidden;
    margin-bottom: 20px;
    min-height: 120px;
    background: var(--zm-gradient);
    background-size: 200% 200%;
    animation: zm-gradient-shift 8s ease infinite;
    box-shadow: var(--zm-shadow-lg);
}
.zm-hero-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url('https://images.unsplash.com/photo-1587854692152-cf860068d409?w=1200&q=80') center/cover;
    opacity: 0.22;
    mix-blend-mode: overlay;
}
.zm-hero-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(15,118,110,0.92) 0%, rgba(99,102,241,0.75) 100%);
}
.zm-hero-inner {
    position: relative;
    z-index: 1;
    padding: 24px 28px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.zm-hero-inner h3 { margin: 0 0 6px; font-size: 1.35rem; font-weight: 800; font-family: var(--zm-heading); }
.zm-hero-inner p { margin: 0; opacity: 0.9; font-size: 0.9rem; max-width: 480px; }
.zm-hero-icons { display: flex; gap: 12px; font-size: 2rem; opacity: 0.85; }
.zm-hero-icons span { animation: zm-float 4s ease-in-out infinite; }
.zm-hero-icons span:nth-child(2) { animation-delay: 0.5s; }
.zm-hero-icons span:nth-child(3) { animation-delay: 1s; }

.content { background: var(--zm-gradient-soft) !important; }

.stat-card, .card-panel, .kpi-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.stat-card:hover, .card-panel:hover, .kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--zm-shadow-lg);
}

.menu-btn { transition: all 0.2s ease; }
.menu-btn:hover { transform: translateX(4px); }

.btn-primary {
    background: var(--zm-gradient) !important;
    background-size: 200% auto !important;
    border: none !important;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.2s, background-position 0.4s !important;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.35);
    background-position: right center !important;
}

.panel-modal { backdrop-filter: blur(8px); }
.panel-modal-card { animation: zm-fade-up 0.35s ease-out; }

.live-badge, .live-dot { animation: zm-pulse-glow 2s infinite; }
.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #34d399; display: inline-block; margin-right: 6px;
}

.module { animation: zm-fade-up 0.45s ease-out; }

.zm-img-decor {
    width: 100%;
    max-height: 140px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: var(--zm-shadow);
}

/* ── Responsive tables ─────────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── Canonical status badge colours (single source of truth) ───────────────── */
/* Per-panel CSS controls the base .status-badge shell (padding/radius/font).  */
/* Only these colour assignments live here so every panel renders consistently. */
.status-placed,
.status-new                  { background: #dbeafe; color: #1d4ed8; }
.status-confirmed            { background: #cffafe; color: #0e7490; }
.status-preparing            { background: #fef3c7; color: #b45309; }
.status-ready-for-pickup,
.status-assigned             { background: #ede9fe; color: #6d28d9; }
.status-picked-up,
.status-out-for-delivery     { background: #d1fae5; color: #047857; }
.status-delivered,
.status-active,
.status-published,
.status-in-zone,
.status-fulfilled,
.status-completed            { background: #dcfce7; color: #15803d; }
.status-cancelled,
.status-rejected,
.status-inactive,
.status-offline              { background: #fee2e2; color: #b91c1c; }
.status-pending,
.status-unread,
.status-requested,
.status-out-of-zone,
.status-no-zone-assigned     { background: #fef3c7; color: #b45309; }
.status-sample-collected,
.status-processing           { background: #ede9fe; color: #5b21b6; }
.status-report-ready         { background: #ecfdf5; color: #065f46; }

/* ── Form validation ──────────────────────────────────────────────────────── */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.invalid-feedback {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #b91c1c;
    margin-top: 4px;
}
.form-control.is-valid,
.form-select.is-valid {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.valid-feedback {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #047857;
    margin-top: 4px;
}
label.required::after,
.form-label.required::after {
    content: " *";
    color: #ef4444;
}

/* ── Mobile sidebar drawer (activates at ≤ 768 px) ───────────────────────── */
/* Hamburger button — injected into .topbar by sidebar-toggle.js (Group D).   */
.sidebar-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--zm-radius-sm);
    background: #ffffff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #334155;
    flex-shrink: 0;
    order: -1;
}
/* Backdrop — injected before .layout by sidebar-toggle.js (Group D).         */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 299;
    cursor: pointer;
}
.sidebar-backdrop.visible {
    display: block;
    animation: zm-fade-in 0.2s ease-out;
}
@media (max-width: 768px) {
    .sidebar-hamburger { display: flex; }
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--zm-sidebar-width);
        max-width: 80vw;
        height: 100vh;
        z-index: 300;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.25);
    }
    .content { padding: var(--zm-space-4); }
}
