/**
 * Shipment Tracker - Theme & Colors
 * CSS Custom Properties for theming
 *
 * @author Wayne Fong (wayneef84)
 * @version 1.0.0
 */

:root {
    /* ============================================================
       PRIMARY COLORS
       ============================================================ */
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #7c8ef5;

    --secondary-color: #f3f4f6;
    --secondary-dark: #e5e7eb;

    /* ============================================================
       TEXT COLORS
       ============================================================ */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;

    /* ============================================================
       BACKGROUND COLORS
       ============================================================ */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    --header-bg: #ffffff;
    --footer-bg: #f9fafb;
    --section-bg: #fafbfc;
    --panel-bg: #ffffff;

    /* ============================================================
       UI ELEMENTS
       ============================================================ */
    --border-color: #d1d5db;
    --border-light: #e5e7eb;

    --btn-bg: #ffffff;
    --btn-hover: #f3f4f6;

    --input-bg: #ffffff;

    /* ============================================================
       TABLE
       ============================================================ */
    --table-header-bg: #f9fafb;
    --row-hover: #f3f4f6;

    /* ============================================================
       STATUS COLORS
       ============================================================ */
    --status-pickup: #3b82f6;        /* Blue */
    --status-transit: #f59e0b;       /* Amber */
    --status-delivery: #10b981;      /* Emerald */
    --status-delivered: #22c55e;     /* Green */
    --status-exception: #f97316;     /* Orange */
    --status-failed: #ef4444;        /* Red */

    /* ============================================================
       NOTIFICATION COLORS
       ============================================================ */
    --success-color: #22c55e;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    /* ============================================================
       TOAST & MODALS
       ============================================================ */
    --toast-bg: #374151;
    --stat-bg: linear-gradient(135deg, #4f46e5 0%, #581c87 100%);

    /* ============================================================
       SHADOWS
       ============================================================ */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.1);

    /* ============================================================
       TRANSITIONS
       ============================================================ */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ============================================================
   DARK MODE (Optional - Future Enhancement)
   ============================================================ */

@media (prefers-color-scheme: dark) {
    :root {
        /* Primary Colors - Keep vibrant */
        --primary-color: #818cf8;
        --primary-dark: #6366f1;
        --primary-light: #a5b4fc;

        --secondary-color: #374151;
        --secondary-dark: #1f2937;

        /* Text Colors */
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-tertiary: #9ca3af;

        /* Background Colors */
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --bg-gradient: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);

        --header-bg: #1f2937;
        --footer-bg: #1f2937;
        --section-bg: #1f2937;
        --panel-bg: #111827;

        /* UI Elements */
        --border-color: #374151;
        --border-light: #2d3748;

        --btn-bg: #374151;
        --btn-hover: #4b5563;

        --input-bg: #1f2937;

        /* Table */
        --table-header-bg: #1f2937;
        --row-hover: #374151;

        /* Status Colors - Keep as is (vibrant in dark mode) */

        /* Toast */
        --toast-bg: #1f2937;
    }
}

/* ============================================================
   CARRIER BRAND COLORS (Optional)
   ============================================================ */

.carrier-dhl {
    --carrier-color: #ffcc00;
    --carrier-text: #d40511;
}

.carrier-fedex {
    --carrier-color: #4d148c;
    --carrier-text: #ff6600;
}

.carrier-ups {
    --carrier-color: #351c15;
    --carrier-text: #ffb500;
}

/* ============================================================
   CUSTOM SCROLLBAR (Webkit browsers)
   ============================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================================
   SELECTION COLOR
   ============================================================ */

::selection {
    background: var(--primary-color);
    color: white;
}

::-moz-selection {
    background: var(--primary-color);
    color: white;
}

/* ============================================================
   FOCUS STYLES
   ============================================================ */

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

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

/* ============================================================
   LOADING STATES
   ============================================================ */

.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .header-controls,
    .settings-panel,
    .export-panel,
    .add-tracking-section,
    .filter-bar,
    .footer,
    .detail-panel,
    .toast-container {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .container {
        box-shadow: none;
    }

    #trackingTable {
        page-break-inside: avoid;
    }

    #trackingTable th,
    #trackingTable td {
        border: 1px solid #ccc;
    }
}
