/* =====================================
   Sales Monitor — Custom Styles
   ===================================== */

:root {
    --topbar-height: 56px;
    --sidebar-width: 240px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;
}

body {
    background-color: #f1f5f9;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    padding-top: var(--topbar-height);
}

/* Topbar */
.app-topbar {
    height: var(--topbar-height);
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1030;
}

.app-topbar .navbar-brand {
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Layout */
.app-wrapper {
    display: flex;
    min-height: calc(100vh - var(--topbar-height));
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    flex-shrink: 0;
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    transition: transform 0.3s;
    z-index: 1020;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

/* Sidebar nav */
.sidebar-nav { padding: 12px 0; }

.sidebar-section {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    padding: 16px 18px 6px;
    letter-spacing: 0.7px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: var(--text-sidebar);
    border-left: 3px solid transparent;
    font-size: 14px;
    transition: all 0.15s;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar-nav .nav-link.active {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
    border-left-color: #3b82f6;
    font-weight: 500;
}

.sidebar-nav .nav-link i {
    font-size: 16px;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--bg-sidebar-hover);
    margin-top: 20px;
}

/* Mobile */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.06);
    border-radius: 10px;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    padding: 14px 18px;
}

/* Stat Cards */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.15s, box-shadow 0.15s;
    height: 100%;
    border-left: 4px solid var(--primary);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-card .stat-label {
    font-size: 13px;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.stat-card .stat-icon {
    font-size: 32px;
    opacity: 0.25;
}

.stat-card.success { border-left-color: #16a34a; }
.stat-card.warning { border-left-color: #f59e0b; }
.stat-card.danger  { border-left-color: #dc2626; }
.stat-card.info    { border-left-color: #0ea5e9; }
.stat-card.purple  { border-left-color: #9333ea; }

/* Page header */
.page-header {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.page-header h4 {
    margin: 0;
    color: #0f172a;
    font-weight: 600;
}

.page-header .breadcrumb {
    margin: 4px 0 0;
    font-size: 13px;
    background: transparent;
    padding: 0;
}

/* Tables */
.table {
    font-size: 14px;
}

.table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid #e2e8f0;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 5px 9px;
    font-size: 11px;
    letter-spacing: 0.3px;
}

/* Forms */
.form-label {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 4px;
}

.form-control, .form-select {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    padding: 8px 12px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
    padding: 20px;
    padding-top: 20px;
}

.login-card {
    background: #fff;
    padding: 35px;
    border-radius: 14px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.18);
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 25px;
}

.login-card .login-logo i {
    font-size: 50px;
    color: var(--primary);
}

.login-card h3 {
    text-align: center;
    margin-bottom: 5px;
    color: #0f172a;
}

.login-card .login-subtitle {
    text-align: center;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 22px;
}

/* Tracking timeline */
.tracking-timeline {
    position: relative;
    padding-left: 30px;
}

.tracking-timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #e2e8f0;
}

.tracking-event {
    position: relative;
    margin-bottom: 18px;
}

.tracking-event::before {
    content: "";
    position: absolute;
    left: -27px;
    top: 6px;
    width: 12px;
    height: 12px;
    background: #94a3b8;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #94a3b8;
}

.tracking-event:first-child::before {
    background: #16a34a;
    box-shadow: 0 0 0 2px #16a34a;
}

.tracking-event .event-time {
    font-size: 12px;
    color: #64748b;
}

.tracking-event .event-desc {
    font-size: 14px;
    color: #1e293b;
    margin-top: 2px;
}

.tracking-event .event-loc {
    font-size: 12px;
    color: #475569;
    font-style: italic;
}

/* Notifications list */
.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.15s;
}

.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #eff6ff; }

.notif-item .notif-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.notif-item .notif-time {
    font-size: 11px;
    color: #94a3b8;
}

/* Quick filter buttons */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

/* Print */
@media print {
    .app-topbar, .app-sidebar, .no-print { display: none !important; }
    .app-main { margin-left: 0 !important; }
    body { padding-top: 0 !important; background: #fff !important; }
}

/* ============================================
   CONFIRM MODAL — Global Confirmation Dialog
   ============================================ */
#globalConfirmModal .modal-dialog {
    max-width: 420px;
}
#globalConfirmModal .modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}
#globalConfirmModal .modal-body {
    padding: 32px 28px 24px;
    text-align: center;
}
#globalConfirmModal .confirm-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 18px;
    animation: confirmIconPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#globalConfirmModal .confirm-icon-wrap.confirm-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}
#globalConfirmModal .confirm-icon-wrap.confirm-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}
#globalConfirmModal .confirm-icon-wrap.confirm-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}
#globalConfirmModal .confirm-icon-wrap.confirm-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}
#globalConfirmModal .confirm-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}
#globalConfirmModal .confirm-message {
    color: #64748b;
    font-size: 14.5px;
    line-height: 1.55;
    margin-bottom: 24px;
}
#globalConfirmModal .confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
#globalConfirmModal .confirm-actions .btn {
    min-width: 110px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
}
#globalConfirmModal .btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: none;
}
#globalConfirmModal .btn-cancel:hover {
    background: #e2e8f0;
    color: #1e293b;
}
#globalConfirmModal .btn-confirm {
    border: none;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
#globalConfirmModal .btn-confirm.btn-danger { background: #dc2626; }
#globalConfirmModal .btn-confirm.btn-danger:hover { background: #b91c1c; }
#globalConfirmModal .btn-confirm.btn-warning { background: #d97706; color: #fff; }
#globalConfirmModal .btn-confirm.btn-warning:hover { background: #b45309; }
#globalConfirmModal .btn-confirm.btn-success { background: #059669; }
#globalConfirmModal .btn-confirm.btn-success:hover { background: #047857; }
#globalConfirmModal .btn-confirm.btn-info { background: #2563eb; }
#globalConfirmModal .btn-confirm.btn-info:hover { background: #1d4ed8; }

@keyframes confirmIconPop {
    0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
    60%  { transform: scale(1.15) rotate(8deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Smooth fade backdrop */
#globalConfirmModal.fade .modal-dialog {
    transform: scale(0.95);
    transition: transform 0.2s ease;
}
#globalConfirmModal.show .modal-dialog {
    transform: scale(1);
}
