/* Just Food Admin — foodappi-inspired minimalist theme */
:root {
    --jf-bg: #f4f6f9;
    --jf-surface: #ffffff;
    --jf-border: #eef1f5;
    --jf-text: #1e293b;
    --jf-muted: #94a3b8;
    --jf-sidebar-w: 260px;
    --jf-radius: 14px;
    --jf-radius-sm: 10px;
    --jf-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
    --jf-shadow-md: 0 8px 28px rgba(15, 23, 42, 0.06);
    --jf-teal: #00bfa5;
    --jf-teal-soft: #e6faf6;
    --jf-teal-dark: #009688;
    --jf-pink: #ff5b8c;
    --jf-purple: #8a70ff;
    --jf-blue: #5c86ff;
    --jf-mint: #00bfa5;
    --jf-orange: #ff9f43;
    --jf-danger: #ef4444;
    --jf-warning: #f59e0b;
    --jf-success: #10b981;
    --jf-font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body.admin-body {
    margin: 0;
    font-family: var(--jf-font);
    background: var(--jf-bg);
    color: var(--jf-text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ——— Shell ——— */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--jf-sidebar-w);
    flex-shrink: 0;
    background: var(--jf-surface);
    border-right: 1px solid var(--jf-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    transition: transform 0.25s ease;
}

.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 22px 18px;
    border-bottom: 1px solid var(--jf-border);
}

.admin-sidebar-brand img {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.admin-sidebar-brand .brand-text {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--jf-teal);
    letter-spacing: -0.02em;
}

.admin-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 24px;
}

.nav-section-label {
    color: var(--jf-muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 14px 12px 6px;
}

.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--jf-radius-sm);
    color: #64748b;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
}

.admin-sidebar .nav-link:hover {
    background: #f8fafc;
    color: var(--jf-text);
}

.admin-sidebar .nav-link.active {
    background: var(--jf-teal-soft);
    color: var(--jf-teal-dark);
    font-weight: 600;
}

.admin-sidebar .nav-link .nav-ico {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.admin-sidebar .nav-link .nav-ico img {
    width: 18px;
    height: 18px;
}

.admin-sidebar .nav-sublink {
    padding-left: 42px;
    font-size: 0.85rem;
}

.admin-main {
    flex: 1;
    margin-left: var(--jf-sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ——— Topbar ——— */
.admin-topbar {
    background: var(--jf-surface);
    border-bottom: 1px solid var(--jf-border);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.admin-topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.admin-topbar-greeting h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--jf-teal-dark);
    letter-spacing: -0.02em;
}

.admin-topbar-greeting .page-sub {
    margin: 2px 0 0;
    color: var(--jf-muted);
    font-size: 0.8rem;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    background: var(--jf-teal-soft);
    color: var(--jf-teal-dark);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
}

.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--jf-border);
    background: var(--jf-surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    position: relative;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.topbar-icon-btn:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.topbar-icon-btn .notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--jf-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
}

.topbar-icon-btn .notif-dot.show {
    display: inline-flex;
}

.topbar-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    border: 1px solid var(--jf-border);
    background: var(--jf-surface);
    cursor: pointer;
}

.topbar-profile-btn img,
.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--jf-teal-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--jf-teal-dark);
}

.topbar-profile-btn .profile-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--jf-text);
}

.sidebar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--jf-border);
    background: #fff;
    cursor: pointer;
}

/* ——— Content ——— */
.admin-content {
    padding: 24px 28px 40px;
    flex: 1;
}

.content-card {
    background: var(--jf-surface);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius);
    box-shadow: var(--jf-shadow);
}

.content-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--jf-border);
    padding: 16px 20px;
    font-weight: 600;
}

.content-card .card-body {
    padding: 20px;
}

/* ——— Metric cards (Row 1 style) ——— */
.metric-card {
    border: 0;
    border-radius: var(--jf-radius);
    color: #fff;
    box-shadow: var(--jf-shadow-md);
    overflow: hidden;
    height: 100%;
}

.metric-card .card-body {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px 20px;
}

.metric-card .metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-card .metric-icon img {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
}

.metric-card .metric-label {
    font-size: 0.8rem;
    opacity: 0.92;
    margin-bottom: 2px;
}

.metric-card .metric-value {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0;
}

.metric-pink { background: linear-gradient(135deg, #ff5b8c 0%, #ff7aa3 100%); }
.metric-purple { background: linear-gradient(135deg, #8a70ff 0%, #a18fff 100%); }
.metric-blue { background: linear-gradient(135deg, #5c86ff 0%, #7a9dff 100%); }
.metric-mint { background: linear-gradient(135deg, #00bfa5 0%, #26d0b8 100%); }
.metric-orange { background: linear-gradient(135deg, #ff9f43 0%, #ffb56b 100%); }

/* ——— Soft stat cards (order statistics) ——— */
.stat-soft-card {
    background: var(--jf-surface);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius);
    box-shadow: var(--jf-shadow);
    padding: 16px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

a.stat-soft-card-link {
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
}

a.stat-soft-card-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--jf-shadow-md);
    border-color: #d7dee8;
    color: inherit;
}

.stat-soft-card .stat-ico {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-soft-card .stat-ico img {
    width: 20px;
    height: 20px;
}

.stat-soft-card .stat-label {
    color: var(--jf-muted);
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.stat-soft-card .stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--jf-text);
}

.stat-ico-pink { background: #ffe8f0; }
.stat-ico-purple { background: #efeaff; }
.stat-ico-blue { background: #e8efff; }
.stat-ico-mint { background: #e6faf6; }
.stat-ico-orange { background: #fff3e6; }
.stat-ico-green { background: #e8f8f0; }
.stat-ico-red { background: #feecec; }
.stat-ico-slate { background: #f1f5f9; }

/* ——— Section headers ——— */
.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--jf-text);
    margin: 0 0 14px;
}

.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

/* ——— Alerts ——— */
.jf-alert {
    border: 0;
    border-radius: var(--jf-radius-sm);
    padding: 12px 16px;
    font-size: 0.875rem;
}

.jf-alert-success {
    background: #e8f8f0;
    color: #047857;
}

.jf-alert-danger {
    background: #feecec;
    color: #b91c1c;
}

.jf-alert-info {
    background: #ffe8f0;
    color: #be185d;
}

/* ——— Tables ——— */
.table {
    --bs-table-bg: transparent;
}

.table > :not(caption) > * > * {
    padding: 12px 14px;
    vertical-align: middle;
}

.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--jf-muted);
    font-weight: 600;
    border-bottom-width: 1px;
    background: #fafbfc;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: #fcfdfe;
}

/* ——— Buttons ——— */
.btn {
    border-radius: 10px;
    font-weight: 550;
    font-size: 0.85rem;
}

.btn-primary {
    --bs-btn-bg: var(--jf-teal);
    --bs-btn-border-color: var(--jf-teal);
    --bs-btn-hover-bg: var(--jf-teal-dark);
    --bs-btn-hover-border-color: var(--jf-teal-dark);
    --bs-btn-active-bg: var(--jf-teal-dark);
    --bs-btn-active-border-color: var(--jf-teal-dark);
}

.btn-outline-primary {
    --bs-btn-color: var(--jf-teal-dark);
    --bs-btn-border-color: #b2ebe3;
    --bs-btn-hover-bg: var(--jf-teal-soft);
    --bs-btn-hover-border-color: var(--jf-teal);
    --bs-btn-hover-color: var(--jf-teal-dark);
}

.btn-success {
    --bs-btn-bg: var(--jf-success);
    --bs-btn-border-color: var(--jf-success);
}

.btn-sm {
    border-radius: 8px;
}

/* ——— Badges ——— */
.badge {
    font-weight: 600;
    border-radius: 999px;
    padding: 0.4em 0.7em;
}

/* ——— Forms ——— */
.form-control,
.form-select {
    border-radius: 10px;
    border-color: #e2e8f0;
    font-size: 0.9rem;
    padding: 0.55rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--jf-teal);
    box-shadow: 0 0 0 0.2rem rgba(0, 191, 165, 0.15);
}

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.35rem;
}

/* ——— DataTables ——— */
.dt-buttons {
    margin-bottom: 0.75rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 0.35rem 0.7rem;
}

div.dt-buttons > .btn {
    border-radius: 8px;
    margin-right: 4px;
}

/* ——— Notification dropdown ——— */
#adminNotificationDropdown {
    min-width: 360px;
    max-height: 420px;
    overflow-y: auto;
    border-radius: var(--jf-radius);
    border: 1px solid var(--jf-border);
    box-shadow: var(--jf-shadow-md);
}

#adminNotificationList .list-group-item {
    white-space: normal;
}

.notification-pulse {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* ——— Orders table aging + status pills ——— */
#ordersTable tbody tr.order-age-warn > td {
    background-color: #fff3cd !important;
}

#ordersTable tbody tr.order-age-danger > td {
    background-color: #f8d7da !important;
}

#ordersTable tbody tr.order-row-highlight > td {
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
}

.order-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.order-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.order-status-pending {
    background: #fff3cd;
    color: #856404;
}

.order-status-accepted {
    background: #cfe2ff;
    color: #084298;
}

.order-status-preparing {
    background: #e0cffc;
    color: #5b2c8a;
}

.order-status-transit {
    background: #cff4fc;
    color: #055160;
}

.order-status-delivered {
    background: #d1e7dd;
    color: #0f5132;
}

.order-status-cancelled {
    background: #e2e3e5;
    color: #41464b;
}

.order-status-rejected {
    background: #f8d7da;
    color: #842029;
}

.order-status-default {
    background: #eef2f7;
    color: #334155;
}

/* ——— Chart panels ——— */
.chart-panel {
    background: var(--jf-surface);
    border: 1px solid var(--jf-border);
    border-radius: var(--jf-radius);
    box-shadow: var(--jf-shadow);
    padding: 20px;
    height: 100%;
}

.chart-panel h6 {
    font-weight: 700;
    margin: 0 0 16px;
}

.chart-canvas-wrap {
    position: relative;
    height: 260px;
}

/* ——— Overlay for mobile sidebar ——— */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1035;
}

.sidebar-backdrop.show {
    display: block;
}

/* ——— Login ——— */
.admin-login-page {
    margin: 0;
    min-height: 100vh;
    font-family: var(--jf-font);
    background: var(--jf-bg);
}

.auth-shell {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    min-height: 100vh;
}

.auth-visual {
    background:
        linear-gradient(145deg, rgba(0, 191, 165, 0.88), rgba(92, 134, 255, 0.75)),
        url("../../images/admin/login-hero.svg") center / cover no-repeat;
    display: flex;
    align-items: flex-end;
    padding: 48px;
    color: #fff;
}

.auth-visual-overlay h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 10px;
}

.auth-visual-overlay p {
    margin: 0;
    opacity: 0.92;
    max-width: 360px;
    line-height: 1.6;
}

.auth-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: 18px;
    padding: 36px 32px;
    box-shadow: var(--jf-shadow-md);
    border: 1px solid var(--jf-border);
}

.auth-card h1 {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--jf-text);
}

.auth-subtitle {
    color: var(--jf-muted);
    margin: 0 0 24px;
    font-size: 0.9rem;
}

.auth-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 14px;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
    width: 100%;
    margin-top: 6px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--jf-teal);
    box-shadow: 0 0 0 3px rgba(0, 191, 165, 0.15);
}

.password-field {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    cursor: pointer;
    margin-top: 3px;
}

.remember-row {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 500 !important;
}

.remember-row input {
    width: auto !important;
    margin: 0 !important;
}

.auth-submit {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    background: var(--jf-teal);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}

.auth-submit:hover {
    background: var(--jf-teal-dark);
}

.notice.auth-error {
    background: #feecec;
    color: #b91c1c;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

/* ——— Responsive ——— */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .admin-content {
        padding: 18px 16px 32px;
    }

    .admin-topbar {
        padding: 14px 16px;
    }

    .topbar-profile-btn .profile-name {
        display: none;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 200px;
        padding: 28px;
    }
}

.food-variations-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem 1rem 0.75rem;
    background: #f8fafc;
}

.food-variations-card .table {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
}

.food-variations-card .table th {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
}
