/* ============================================
   Warpmonger POS - Design System
   ============================================ */

/* --- Design Tokens (CSS Custom Properties) --- */
:root {
    /* Layout */
    --sidebar-width: 250px;

    /* Sidebar */
    --sidebar-bg: #1a202c;
    --sidebar-text: #a0aec0;
    --sidebar-text-active: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.1);
    --sidebar-border: rgba(255, 255, 255, 0.1);

    /* Location colors */
    --color-taiwan: #3b82f6;
    --color-china: #f59e0b;
    --color-transit: #eab308;

    /* Stat card accent colors */
    --stat-blue: #3182ce;
    --stat-green: #38a169;
    --stat-yellow: #d69e2e;
    --stat-red: #e53e3e;

    /* Surfaces */
    --bg-page: #f7fafc;
    --bg-surface: #ffffff;
    --border-color: #e2e8f0;

    /* Badge custom colors */
    --badge-supplement: #0dcaf0;      /* info / light blue */
    --badge-modification: #9c27b0;    /* purple */
    --badge-preorder: #ffc107;        /* warning / yellow */
    --badge-deprecated: #6c757d;      /* secondary / gray */
}

/* --- Base Layout --- */
body {
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text-active);
    padding-top: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 0.5rem;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.sidebar .nav-link i {
    font-size: 1.1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 0 1.5rem 1rem;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 0.5rem;
}

/* Sidebar nav sections */
.nav-section {
    margin-top: 0.5rem;
}

.nav-section small {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-section.tw-header small {
    color: #60a5fa;
}

.nav-section.cn-header small {
    color: #fbbf24;
}

.nav-group-tw {
    border-left: 3px solid var(--color-taiwan);
    margin-left: 0.5rem;
    padding-left: 0;
}

.nav-group-tw .nav-link {
    padding-left: 1rem;
}

.nav-group-cn {
    border-left: 3px solid var(--color-china);
    margin-left: 0.5rem;
    padding-left: 0;
}

.nav-group-cn .nav-link {
    padding-left: 1rem;
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-page);
}

.top-bar {
    background: var(--bg-surface);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-area {
    padding: 1.5rem;
}

/* --- Cards --- */
.card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Stat cards with left accent border */
.stat-card {
    border-left: 4px solid;
}

.stat-card.blue { border-left-color: var(--stat-blue); }
.stat-card.green { border-left-color: var(--stat-green); }
.stat-card.yellow { border-left-color: var(--stat-yellow); }
.stat-card.red { border-left-color: var(--stat-red); }

/* --- Status Badge --- */
.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* --- Location Badges --- */
.badge-tw {
    background-color: var(--color-taiwan) !important;
    color: #fff;
}

.badge-cn {
    background-color: var(--color-china) !important;
    color: #fff;
}

.badge-transit {
    background-color: var(--color-transit) !important;
    color: #212529;
}

/* --- Product Tag Badges --- */
.badge-supplement {
    background-color: var(--badge-supplement) !important;
    color: #fff;
}

.badge-modification {
    background-color: var(--badge-modification) !important;
    color: #fff;
}

.badge-preorder {
    background-color: var(--badge-preorder) !important;
    color: #fff;
}

.badge-deprecated {
    background-color: var(--badge-deprecated) !important;
    color: #fff;
}

/* --- Order Status Badges --- */
.badge-status-waiting {
    background-color: #6c757d !important;
    color: #fff;
}

.badge-status-china {
    background-color: var(--color-china) !important;
    color: #fff;
}

.badge-status-transit {
    background-color: var(--color-transit) !important;
    color: #212529;
}

.badge-status-taiwan {
    background-color: var(--color-taiwan) !important;
    color: #fff;
}

.badge-status-shipped {
    background-color: #198754 !important;
    color: #fff;
}

.badge-status-settled {
    background-color: #212529 !important;
    color: #fff;
}

/* --- Inquiry Status Badges --- */
.badge-status-pending-price {
    background-color: #ffc107 !important;
    color: #000;
}

.badge-status-priced {
    background-color: #17a2b8 !important;
    color: #fff;
}

.badge-status-confirmed {
    background-color: #28a745 !important;
    color: #fff;
}

.badge-status-cancelled {
    background-color: #6c757d !important;
    color: #fff;
}

/* --- China Stock Alert Badges --- */
.badge-new-order {
    background-color: #dc3545 !important;
    color: #fff;
}

.badge-tw-soldout {
    background-color: #e65100 !important;
    color: #fff;
}

/* --- Order Source Badges --- */
.badge-source-shopee {
    background-color: #198754 !important;
    color: #fff;
}

.badge-source-line {
    background-color: #0dcaf0 !important;
    color: #fff;
}

.badge-source-other {
    background-color: #6c757d !important;
    color: #fff;
}

/* --- Tables --- */
.table-clickable tbody tr {
    cursor: pointer;
}

.table-clickable tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h5 {
    color: #495057;
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* --- Search Dropdown --- */
.search-dropdown {
    position: absolute;
    z-index: 1050;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    display: none;
}

.search-dropdown.show {
    display: block;
}

.search-dropdown .dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.search-dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 0;
}

.filter-bar .form-select,
.filter-bar .form-control {
    width: auto;
    min-width: 120px;
}

/* --- Modal Consistency --- */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-select,
    .filter-bar .form-control {
        width: 100%;
    }
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-container .toast-msg {
    pointer-events: auto;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toastSlideIn 0.3s ease-out;
    max-width: 400px;
}

.toast-msg.toast-success { background-color: #198754; }
.toast-msg.toast-error { background-color: #dc3545; }
.toast-msg.toast-warning { background-color: #fd7e14; }
.toast-msg.toast-info { background-color: #0dcaf0; color: #212529; }

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* --- Status Timeline --- */
.status-timeline {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0.5rem 0;
    overflow-x: auto;
}

.status-timeline .timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 60px;
    position: relative;
}

.status-timeline .timeline-step .step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    z-index: 1;
}

.status-timeline .timeline-step.completed .step-dot {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.status-timeline .timeline-step.active .step-dot {
    background: var(--color-taiwan);
    border-color: var(--color-taiwan);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.status-timeline .timeline-step .step-label {
    font-size: 0.65rem;
    margin-top: 0.25rem;
    color: #6c757d;
    text-align: center;
    white-space: nowrap;
}

.status-timeline .timeline-step.completed .step-label,
.status-timeline .timeline-step.active .step-label {
    color: #212529;
    font-weight: 600;
}

.status-timeline .timeline-connector {
    flex: 1;
    height: 2px;
    background: #dee2e6;
    min-width: 20px;
    margin-top: -12px;
}

.status-timeline .timeline-connector.completed {
    background: #198754;
}

/* --- Confirm Modal --- */
#confirmModal .modal-footer .btn-confirm {
    min-width: 80px;
}
