/* ==========================================================================
   E-KANTIN GLOBAL DESIGN SYSTEM
   Universal UI/UX Standard across Auth, Buyer, Seller, and Admin
   ========================================================================== */

:root {
    --bs-font-sans-serif: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bs-primary: #1d4ed8;
    --bs-primary-rgb: 29, 78, 216;

    /* Surface & Border Colors */
    --ek-bg: #f8fafc;
    --ek-surface: #ffffff;
    --ek-surface-muted: #f8fafc;
    --ek-border: #e2e8f0;
    --ek-border-strong: #cbd5e1;

    /* Text Colors */
    --ek-text: #0f172a;
    --ek-text-secondary: #475569;
    --ek-text-muted: #64748b;

    /* Brand & Accent */
    --ek-primary: #1d4ed8;
    --ek-primary-hover: #1e40af;
    --ek-primary-soft: #eff6ff;

    /* Radii */
    --ek-radius-card: 12px;
    --ek-radius-control: 8px;
    --ek-radius-sm: 6px;

    /* Component Heights */
    --ek-control-height: 40px;
    --ek-control-height-sm: 36px;

    /* Spacing */
    --ek-section-gap: 24px;
    --ek-card-pad: 24px;
    --ek-card-pad-sm: 20px;

    /* Shadows */
    --ek-shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --ek-shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
    --ek-shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
}

/* ==================== BASE & TYPOGRAPHY ==================== */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    font-family: var(--bs-font-sans-serif);
    background-color: var(--ek-bg);
    color: var(--ek-text);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Consistent Typography Scale */
h1, .h1, .page-title {
    font-size: clamp(1.375rem, 2.2vw, 1.625rem); /* 22px - 26px */
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--ek-text);
    margin-bottom: 0;
}

h2, .h2, h3, .h3, .section-title {
    font-size: clamp(1rem, 1.5vw, 1.125rem); /* 16px - 18px */
    font-weight: 600;
    line-height: 1.35;
    color: var(--ek-text);
}

h4, .h4, h5, .h5, h6, .h6 {
    font-size: 1rem; /* 16px */
    font-weight: 600;
    line-height: 1.4;
    color: var(--ek-text);
}

.page-subtitle {
    font-size: 13px;
    color: var(--ek-text-muted);
    line-height: 1.45;
    margin-top: 4px;
    margin-bottom: 0;
}

.text-label {
    font-size: 12px;
    color: var(--ek-text-muted);
    font-weight: 500;
}

.kpi-value {
    font-size: clamp(1.5rem, 2.2vw, 1.875rem); /* 24px - 30px */
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--ek-text);
}

.price-main {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--ek-primary);
    line-height: 1.2;
}

.small, small {
    font-size: 12.5px;
}

.fs-xs {
    font-size: 12px !important;
}

/* ==================== CONTAINER & LAYOUT ==================== */
.app-container {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    width: 100%;
}

@media (max-width: 767.98px) {
    body {
        padding-bottom: 76px !important;
    }
    .app-container {
        padding-left: 16px;
        padding-right: 16px;
    }
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: var(--ek-section-gap);
}

@media (min-width: 576px) {
    .page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.section-gap {
    margin-bottom: var(--ek-section-gap);
}

/* ==================== NAVBAR & ROLE IDENTITY ==================== */
.ek-navbar {
    background-color: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 64px;
    padding-top: 8px;
    padding-bottom: 8px;
}

.ek-brand-logo {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ek-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.stall-thumb {
    width: 52px;
    height: 52px;
    min-width: 52px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.stall-card-img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}

.hero-photo-banner {
    position: relative;
    border-radius: var(--ek-radius-card);
    overflow: hidden;
    background-size: cover;
    background-position: center;
    min-height: 190px;
}

.hero-photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.84) 0%, rgba(15, 23, 42, 0.62) 60%, rgba(15, 23, 42, 0.42) 100%);
}

.hero-photo-content {
    position: relative;
    z-index: 1;
}

.ek-role-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    line-height: 1.2;
    white-space: nowrap;
}

.ek-role-admin {
    background-color: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.ek-role-seller {
    background-color: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.ek-role-buyer {
    background-color: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.ek-navbar .nav-link {
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
    padding: 8px 14px;
    border-radius: var(--ek-radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.ek-navbar .nav-link:hover {
    color: #f8fafc;
    background-color: rgba(255, 255, 255, 0.06);
}

.ek-navbar .nav-link.active {
    color: #ffffff;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.12);
}

.ek-navbar .nav-link i {
    font-size: 16px;
}

/* ==================== UNIFORM FORM CONTROLS & BUTTONS ==================== */
.form-control,
.form-select {
    font-size: 14px;
    min-height: var(--ek-control-height);
    padding: 8px 12px;
    border-radius: var(--ek-radius-control);
    border: 1px solid var(--ek-border-strong);
    color: var(--ek-text);
    background-color: var(--ek-surface);
    font-weight: 400;
}

textarea.form-control {
    min-height: 84px;
}

.form-control-sm,
.form-select-sm {
    min-height: var(--ek-control-height-sm);
    font-size: 13.5px;
    padding: 6px 10px;
    border-radius: var(--ek-radius-sm);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ek-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.form-label {
    font-weight: 600;
    color: var(--ek-text-secondary);
    margin-bottom: 6px;
    font-size: 13px;
}

.input-group-text {
    border-color: var(--ek-border-strong);
    background-color: #f8fafc;
    color: var(--ek-text-muted);
    font-size: 14px;
}

.btn {
    border-radius: var(--ek-radius-control);
    font-weight: 600;
    padding: 8px 16px;
    min-height: var(--ek-control-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    line-height: 1.25;
    transition: all 0.15s ease-in-out;
}

.btn i {
    font-size: 18px;
    line-height: 1;
}

.btn-sm {
    min-height: var(--ek-control-height-sm);
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--ek-radius-sm);
}

.btn-sm i {
    font-size: 15px;
}

.btn-lg {
    min-height: 44px;
    padding: 10px 20px;
    font-size: 15px;
    border-radius: var(--ek-radius-control);
}

/* Quick Stock Stepper Buttons */
.qty-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    aspect-ratio: 1 / 1;
    border-radius: var(--ek-radius-control);
    font-size: 18px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

/* ==================== CARDS & KPI SURFACES ==================== */
.card {
    border: 1px solid var(--ek-border);
    border-radius: var(--ek-radius-card);
    box-shadow: var(--ek-shadow-xs);
    background-color: var(--ek-surface);
}

.card-padded {
    padding: var(--ek-card-pad);
}

@media (max-width: 767.98px) {
    .card-padded {
        padding: var(--ek-card-pad-sm);
    }
}

.card-header {
    background-color: var(--ek-surface);
    border-bottom: 1px solid var(--ek-border);
    padding: 16px 20px;
}

.card-hover {
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card-hover:hover {
    border-color: #93c5fd;
    transform: translateY(-2px);
    box-shadow: var(--ek-shadow-md);
}

/* Clean KPI Card */
.kpi-card {
    border: 1px solid var(--ek-border);
    border-radius: var(--ek-radius-card);
    background-color: var(--ek-surface);
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--ek-shadow-xs);
}

.kpi-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.kpi-card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ek-text-muted);
}

.kpi-icon-box {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

/* ==================== SOFT STATUS BADGES ==================== */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-soft-success {
    background-color: #dcfce7 !important;
    color: #166534 !important;
    border: 1px solid #bbf7d0 !important;
}

.badge-soft-warning {
    background-color: #fef9c3 !important;
    color: #854d0e !important;
    border: 1px solid #fde047 !important;
}

.badge-soft-primary {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    border: 1px solid #bfdbfe !important;
}

.badge-soft-danger {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
}

.badge-soft-neutral {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
}

/* Legacy class aliases mapped to soft badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    line-height: 1.2;
    white-space: nowrap;
}
.status-badge-pending {
    background-color: #fef9c3 !important;
    color: #854d0e !important;
    border: 1px solid #fde047 !important;
}
.status-badge-processing {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    border: 1px solid #bfdbfe !important;
}
.status-badge-ready {
    background-color: #dcfce7 !important;
    color: #166534 !important;
    border: 1px solid #bbf7d0 !important;
}
.status-badge-completed {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
}
.status-badge-cancelled {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
}

/* ==================== CLEAN DATA TABLES ==================== */
.table-clean {
    font-size: 14px;
    margin-bottom: 0;
}

.table-clean thead th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ek-text-muted);
    background-color: #f8fafc;
    border-bottom: 1px solid var(--ek-border);
    padding: 12px 16px;
    white-space: nowrap;
}

.table-clean tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--ek-text);
}

.table-clean tbody tr:last-child td {
    border-bottom: none;
}

.table-clean tbody tr:hover {
    background-color: #f8fafc;
}

/* Keep .table-custom working identically */
.table-custom {
    font-size: 14px;
    margin-bottom: 0;
}
.table-custom th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ek-text-muted);
    background-color: #f8fafc;
    border-bottom: 1px solid var(--ek-border);
    padding: 12px 16px;
    white-space: nowrap;
}
.table-custom td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

/* ==================== IMAGES ==================== */
.menu-thumb {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.menu-img-cover {
    width: 100%;
    height: 176px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 11px 11px 0 0;
    display: block;
}

/* ==================== AUTH LAYOUT ==================== */
.auth-wrapper {
    max-width: 440px;
    margin: 16px auto;
    width: 100%;
}

/* ==================== SCROLLBARS ==================== */
.no-scrollbar,
.overflow-x-auto {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar,
.overflow-x-auto::-webkit-scrollbar {
    display: none;
    height: 0;
    width: 0;
}

/* ==================== STRICT UNIVERSAL MODAL CENTERING ==================== */
html.modal-open,
body.modal-open {
    overflow: hidden !important;
    height: 100% !important;
    touch-action: none !important;
    overscroll-behavior: none !important;
}

.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 1050 !important;
    pointer-events: auto !important;
}

.modal {
    z-index: 1055 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.modal-dialog {
    margin-left: auto !important;
    margin-right: auto !important;
    pointer-events: auto !important;
    z-index: 1056 !important;
}

.modal-dialog-centered {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: calc(100% - 2rem) !important;
    margin-top: auto !important;
    margin-bottom: auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.modal-dialog-popup {
    max-width: min(420px, calc(100% - 1.5rem)) !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.modal-content {
    pointer-events: auto !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35) !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    border-radius: var(--ek-radius-card);
}

/* ==================== MOBILE BOTTOM NAVIGATION ==================== */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-top: 1px solid var(--ek-border);
    z-index: 1030;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.05);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    text-decoration: none;
    color: var(--ek-text-muted);
    font-size: 11px;
    font-weight: 600;
    transition: color 0.15s ease-in-out;
    user-select: none;
}

.mobile-nav-item.active {
    color: var(--ek-primary);
    font-weight: 700;
}

.mobile-nav-item i {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 3px;
}

.mobile-nav-badge {
    position: absolute;
    top: -4px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #ef4444;
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    border: 2px solid #ffffff;
    pointer-events: none;
}

/* ==================== PRINT MEDIA ==================== */
@media print {
    nav, .navbar, .mobile-bottom-nav, .btn, .no-print, footer, .modal {
        display: none !important;
    }
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt !important;
        padding-bottom: 0 !important;
    }
    .app-container {
        max-width: 100% !important;
        padding: 0 !important;
    }
    .card {
        border: 1px solid #000000 !important;
        box-shadow: none !important;
    }
    .table-clean th, .table-clean td,
    .table-custom th, .table-custom td {
        border: 1px solid #000000 !important;
        padding: 6px !important;
    }
    .print-only {
        display: block !important;
    }
}

@media screen {
    .print-only {
        display: none !important;
    }
}
