/* ==========================================================
   COBO MILK - Admin Dashboard Stylesheet
   Modern, crisp, responsive, high-contrast dashboard
   ========================================================== */

:root {
    --admin-primary: #15803d;
    --admin-primary-dark: #166534;
    --admin-sidebar-bg: #0f172a;
    --admin-sidebar-hover: #1e293b;
    --admin-sidebar-text: #94a3b8;
    --admin-sidebar-active: #38bdf8;
    --admin-bg: #f8fafc;
    --admin-card: #ffffff;
    --admin-border: #e2e8f0;
    --admin-text: #0f172a;
    --admin-muted: #64748b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 240px;
    background: var(--admin-sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 16px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}

.sidebar-badge {
    font-size: 9px;
    background: #22c55e;
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
}

.sidebar-nav {
    list-style: none;
    padding: 16px 8px;
    flex: 1;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 12px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--admin-sidebar-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin-bottom: 3px;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: var(--admin-sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: #1e293b;
    color: #38bdf8;
    font-weight: 700;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

/* Main Content Area */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: hidden;
}

.admin-header {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--admin-text);
}

.admin-user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
}

.admin-role-badge {
    font-size: 10px;
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 700;
}

.admin-content {
    padding: 24px;
    flex: 1;
}

/* Filter Period Bar */
.filter-bar {
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.period-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.period-pill {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--admin-muted);
    background: #f1f5f9;
    transition: all 0.2s;
}

.period-pill:hover,
.period-pill.active {
    background: var(--admin-primary);
    color: #fff;
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--admin-primary);
}

.kpi-card.pending::before { background: #f59e0b; }
.kpi-card.processing::before { background: #3b82f6; }
.kpi-card.dispatched::before { background: #8b5cf6; }
.kpi-card.completed::before { background: #10b981; }
.kpi-card.cancelled::before { background: #ef4444; }

.kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--admin-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--admin-text);
}

.kpi-sub {
    font-size: 11px;
    color: var(--admin-muted);
    margin-top: 2px;
}

/* Card & Table */
.data-card {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.data-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

table.admin-table th {
    background: #f8fafc;
    padding: 11px 16px;
    font-weight: 600;
    color: var(--admin-muted);
    border-bottom: 1px solid var(--admin-border);
    white-space: nowrap;
}

table.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--admin-border);
    vertical-align: middle;
}

table.admin-table tr:hover td {
    background: #f8fafc;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-PENDING { background: #fef3c7; color: #92400e; }
.status-CONFIRMED { background: #e0e7ff; color: #3730a3; }
.status-PROCESSING { background: #dbeafe; color: #1e40af; }
.status-DISPATCHED { background: #ede9fe; color: #5b21b6; }
.status-COMPLETED { background: #d1fae5; color: #065f46; }
.status-CANCELLED { background: #fee2e2; color: #991b1b; }
.status-PAYMENT_PENDING { background: #ffedd5; color: #9a3412; }
.status-ACTIVE { background: #dcfce7; color: #15803d; }
.status-INACTIVE { background: #f1f5f9; color: #475569; }

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--admin-text);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--admin-border);
    border-radius: var(--radius-sm);
    outline: none;
    background: #fff;
}

.form-control:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.15);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-backdrop.show {
    display: flex;
}

.modal-card {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--admin-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100%;
        height: auto;
    }
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 8px;
    }
    .sidebar-link {
        white-space: nowrap;
    }
    .admin-content {
        padding: 14px;
    }
}

/* ==========================================================
   GLOBAL LINKS & TYPOGRAPHY
   ========================================================== */
a {
    color: var(--admin-primary);
    text-decoration: none;
    transition: all 0.15s ease;
}

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

button {
    font-family: inherit;
    cursor: pointer;
}

/* ==========================================================
   BUTTON DESIGN SYSTEM
   ========================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    transition: all 0.18s ease;
    user-select: none;
    vertical-align: middle;
}

.btn:hover {
    text-decoration: none !important;
}

.btn:focus-visible {
    outline: 2px solid var(--admin-primary);
    outline-offset: 2px;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Sizes */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 700;
}

.btn-xs {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 4px;
    font-weight: 700;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 8px;
    font-weight: 700;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Primary Button (Cobalt/Emerald Green) */
.btn-primary {
    background: #15803d !important;
    color: #ffffff !important;
    border-color: #15803d !important;
    box-shadow: 0 1px 2px rgba(21, 128, 61, 0.25);
}
.btn-primary:hover {
    background: #166534 !important;
    border-color: #166534 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 5px rgba(21, 128, 61, 0.35);
}

/* Outline / Neutral Button */
.btn-outline {
    background: #ffffff !important;
    color: #334155 !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn-outline:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

/* Secondary Button */
.btn-secondary {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-color: #e2e8f0 !important;
}
.btn-secondary:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Success Button */
.btn-success {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
}
.btn-success:hover {
    background: #15803d !important;
    border-color: #15803d !important;
    color: #ffffff !important;
}

/* Danger Button */
.btn-danger {
    background: #fee2e2 !important;
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}
.btn-danger:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
}

/* Warning Button */
.btn-warning {
    background: #fef3c7 !important;
    color: #92400e !important;
    border-color: #fde68a !important;
}
.btn-warning:hover {
    background: #f59e0b !important;
    color: #ffffff !important;
    border-color: #f59e0b !important;
}

/* WhatsApp Communication Button */
.btn-whatsapp {
    background: #25D366 !important;
    color: #ffffff !important;
    border-color: #22c55e !important;
    box-shadow: 0 1px 3px rgba(37, 211, 102, 0.35);
}
.btn-whatsapp:hover {
    background: #1eb954 !important;
    border-color: #1eb954 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.45);
}

/* Rider / Sky Info Button */
.btn-rider, .btn-sky {
    background: #0ea5e9 !important;
    color: #ffffff !important;
    border-color: #0284c7 !important;
    box-shadow: 0 1px 3px rgba(14, 165, 233, 0.35);
}
.btn-rider:hover, .btn-sky:hover {
    background: #0284c7 !important;
    border-color: #0369a1 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.45);
}

/* Back Link Button */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #15803d !important;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none !important;
    transition: all 0.15s ease;
}
.btn-back:hover {
    background: #dcfce7;
    color: #166534 !important;
    border-color: #86efac;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
}
.badge-featured { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-bestseller { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-new { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }

/* Filter & Form Button Defaults */
.filter-bar button[type="submit"]:not(.btn),
.data-card form button[type="submit"]:not(.btn) {
    background: #15803d;
    color: #ffffff;
    border: 1px solid #15803d;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.filter-bar button[type="submit"]:not(.btn):hover,
.data-card form button[type="submit"]:not(.btn):hover {
    background: #166534;
    border-color: #166534;
}

/* Admin Footer */
.admin-footer {
    text-align: center;
    padding: 18px 20px;
    font-size: 12px;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
    background: #ffffff;
    width: 100%;
}
