/* ============================================
   Distribution Tracker - Custom Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Color Palette - Kelarisan Theme */
    --primary: #0E9AA7;
    --primary-dark: #0B7F8A;
    --primary-light: #E6F7F8;
    --secondary: #F58C4E;
    --accent: #F7A0B5;
    --success: #0E9AA7;
    --warning: #F0E788;
    --danger: #ef4444;
    --info: #F7A0B5;
    --orange: #F58C4E;
    --yellow: #F0E788;
    --teal: #0E9AA7;
    --pink: #F7A0B5;

    /* Neutrals */
    --bg-body: #f5f6f8;
    --bg-card: #ffffff;
    --bg-sidebar: #0a3d40;
    --bg-sidebar-hover: #0d4f53;
    --bg-sidebar-active: #F58C4E;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #b0d4d6;
    --border-color: #e2e8f0;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);

    /* Transition */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    z-index: 1040;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-decoration: none;
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--secondary), #F0E788);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.sidebar-brand .brand-text small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 16px 12px;
    list-style: none;
}

.sidebar-nav .nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 16px 14px 8px;
}

.sidebar-nav .nav-item {
    margin-bottom: 2px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--bg-sidebar-active);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245, 140, 78, 0.3);
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* ===== TOP HEADER ===== */
.top-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-header .page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-header .header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-toggle-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.btn-toggle-sidebar:hover {
    background: var(--bg-body);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(14, 154, 167, 0.25);
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 24px 28px;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card.card-primary::before {
    background: var(--primary);
}

.stat-card.card-success::before {
    background: var(--success);
}

.stat-card.card-warning::before {
    background: var(--warning);
}

.stat-card.card-danger::before {
    background: var(--danger);
}

.stat-card.card-info::before {
    background: var(--info);
}

.stat-card.card-orange::before {
    background: var(--orange);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-card.card-primary .stat-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card.card-success .stat-icon {
    background: #e6f7f8;
    color: var(--success);
}

.stat-card.card-warning .stat-icon {
    background: #fdfce8;
    color: #b8a800;
}

.stat-card.card-danger .stat-icon {
    background: #fef2f2;
    color: var(--danger);
}

.stat-card.card-info .stat-icon {
    background: #fdf0f4;
    color: var(--info);
}

.stat-card.card-orange .stat-icon {
    background: #fff3e8;
    color: var(--orange);
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
}

/* ===== CARDS ===== */
.content-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.content-card .card-header-custom {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.content-card .card-header-custom h5 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-card .card-body-custom {
    padding: 24px;
}

/* ===== TABLES ===== */
.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom thead th {
    background: var(--bg-body);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13.5px;
    vertical-align: middle;
}

.table-custom tbody tr:hover {
    background: #f8fafc;
}

.table-custom tbody tr:last-child td {
    border-bottom: none;
}

/* ===== BADGES ===== */
.badge.bg-orange {
    background: var(--orange) !important;
}

.badge.bg-teal {
    background: var(--teal) !important;
}

.badge {
    font-weight: 600;
    font-size: 11.5px;
    padding: 5px 10px;
    border-radius: 6px;
    letter-spacing: 0.2px;
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 154, 167, 0.3);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
}

.btn-success:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* ===== FORMS ===== */
.form-control,
.form-select {
    border-radius: var(--border-radius-sm);
    border: 1.5px solid var(--border-color);
    padding: 10px 14px;
    font-size: 13.5px;
    transition: var(--transition);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 154, 167, 0.15);
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ===== MODAL ===== */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 24px;
}

.modal-title {
    font-weight: 700;
    font-size: 16px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== OVERLAY ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0E9AA7 0%, #0a3d40 50%, #0E9AA7 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(245, 140, 78, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(247, 160, 181, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
    animation: loginCardIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes loginCardIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-card .login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), #0d6e76);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 30px;
    font-weight: 800;
    margin: 0 auto 24px;
    box-shadow: 0 8px 24px rgba(14, 154, 167, 0.35);
    position: relative;
}

.login-card .login-logo::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--secondary), var(--pink), var(--yellow));
    z-index: -1;
    opacity: 0.4;
    filter: blur(8px);
}

.login-card h2 {
    text-align: center;
    font-weight: 800;
    margin-bottom: 4px;
    font-size: 22px;
    color: var(--primary);
}

.login-card p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-size: 13px;
}

.login-card .login-version {
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 28px;
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0.7;
}

.login-card .form-control {
    padding: 12px 16px;
    font-size: 14px;
    border: 1.5px solid #e2e8f0;
    transition: var(--transition);
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 154, 167, 0.12);
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #0d6e76);
    border: none;
    box-shadow: 0 4px 16px rgba(14, 154, 167, 0.3);
}

.login-card .btn-primary:hover {
    box-shadow: 0 8px 24px rgba(14, 154, 167, 0.4);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #0B7F8A, #0a5e66);
}

.login-footer-info {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.login-footer-info .color-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.login-footer-info .color-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.login-footer-info p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
    letter-spacing: 0.3px;
}

/* ===== SYNC BUTTON ===== */
.btn-sync {
    position: relative;
    overflow: hidden;
}

.btn-sync.syncing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== TIMELINE ===== */
.order-timeline {
    position: relative;
    padding-left: 30px;
}

.order-timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-item .timeline-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    position: absolute;
    left: -30px;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    z-index: 1;
}

.timeline-dot.active {
    background: var(--primary);
}

.timeline-dot.success {
    background: var(--success);
}

.timeline-dot.warning {
    background: var(--warning);
}

.timeline-dot.danger {
    background: var(--danger);
}

.timeline-dot.muted {
    background: var(--text-muted);
}

.timeline-item .timeline-content {
    background: var(--bg-body);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
}

.timeline-item .timeline-content h6 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}

.timeline-item .timeline-content small {
    color: var(--text-muted);
    font-size: 11px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .btn-toggle-sidebar {
        display: block;
    }

    .top-header {
        padding: 0 16px;
    }

    .page-content {
        padding: 16px;
    }

    .login-card {
        padding: 36px 28px;
    }
}

@media (max-width: 575.98px) {
    .stat-card {
        padding: 18px;
    }

    .stat-card .stat-value {
        font-size: 24px;
    }

    .content-card .card-header-custom {
        padding: 16px 18px;
    }

    .content-card .card-body-custom {
        padding: 16px 18px;
    }

    .table-responsive {
        font-size: 12px;
    }
}

/* ===== PULSE ANIMATION ===== */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* ===== ORDER PRIORITY URGENT ===== */
.order-urgent {
    border-left: 3px solid var(--danger) !important;
}

/* ===== DELIVERY CARD ===== */
.delivery-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.delivery-card:hover {
    box-shadow: var(--shadow-sm);
}

.delivery-card .outlet-name {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
}

.delivery-card .outlet-address {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ===== SYNC PROGRESS ===== */
.sync-progress {
    background: var(--bg-body);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    margin-top: 12px;
}

.sync-progress .progress {
    height: 6px;
    border-radius: 3px;
}

/* ===== NOTIFICATION DOT ===== */
.notification-dot {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    position: absolute;
    top: -2px;
    right: -2px;
}