/* Custom Stylesheet for Motion Aqua Dashboard */

:root {
    /* Color Tokens (Dark Mode Default) */
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-glow: rgba(2, 132, 199, 0.15);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    
    --background: #0b0f19;
    --card-bg: #111827;
    --sidebar-bg: #0d121f;
    --sidebar-border: #1f2937;
    --border: rgba(255, 255, 255, 0.08);
    
    --text: #f9fafb;
    --text-muted: #9ca3af;
    --input-bg: #1f2937;
    --input-border: #374151;
    
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.3), 0 2px 8px -1px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 20px 2px rgba(2, 132, 199, 0.25);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
}

[data-theme="light"] {
    /* Color Tokens (Light Mode) */
    --background: #f8fafc;
    --card-bg: #ffffff;
    --sidebar-bg: #f1f5f9;
    --sidebar-border: #e2e8f0;
    --border: rgba(0, 0, 0, 0.06);
    
    --text: #0f172a;
    --text-muted: #64748b;
    --input-bg: #f8fafc;
    --input-border: #cbd5e1;
    
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 8px -1px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 0 20px 2px rgba(2, 132, 199, 0.15);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

body {
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 17px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--sidebar-border);
}

.logo-box {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0ea5e9, #0d9488);
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
}

.logo-icon {
    color: #ffffff;
    width: 20px;
    height: 20px;
}

.brand-text h2 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.brand-text span {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--primary);
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-item i, .nav-item svg {
    width: 18px;
    height: 18px;
}

.nav-item:hover {
    color: var(--text);
    background-color: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    color: #ffffff;
    background-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

[data-theme="light"] .nav-item.active {
    color: #ffffff;
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--sidebar-border);
}

/* Mobile Header */
.mobile-header {
    display: none;
    height: 56px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
}

.menu-toggle, .mobile-signout {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 8px;
    display: grid;
    place-items: center;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
}

.mobile-brand .logo-icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - 260px);
}

/* Top Navbar */
.top-navbar {
    height: 76px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background-color: transparent;
}

.page-title-box h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 13px;
}

.top-navbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    color: var(--text);
    background-color: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.theme-toggle .sun-icon {
    display: none;
}

[data-theme="light"] .theme-toggle .sun-icon {
    display: block;
}

[data-theme="light"] .theme-toggle .moon-icon {
    display: none;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.live-dot {
    width: 6px;
    height: 6px;
    background-color: var(--success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--success);
    animation: pulse-dot 1.5s infinite ease-in-out;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.15); }
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-family: var(--font-display);
    font-size: 14px;
}

.user-profile-details {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.profile-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px 40px;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* Stat Card */
.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-glow);
    border-color: rgba(2, 132, 199, 0.3);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.15;
    pointer-events: none;
}

.stat-card.tone-primary::after { background: var(--primary); }
.stat-card.tone-success::after { background: var(--success); }
.stat-card.tone-warning::after { background: var(--warning); }
.stat-card.tone-danger::after { background: var(--danger); }
.stat-card.tone-muted::after { background: var(--text-muted); }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.stat-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background-color: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

.stat-card.tone-primary .stat-icon-wrapper { color: var(--primary); background: rgba(2, 132, 199, 0.1); }
.stat-card.tone-success .stat-icon-wrapper { color: var(--success); background: var(--success-bg); }
.stat-card.tone-warning .stat-icon-wrapper { color: var(--warning); background: var(--warning-bg); }
.stat-card.tone-danger .stat-icon-wrapper { color: var(--danger); background: var(--danger-bg); }

.stat-icon-wrapper i, .stat-icon-wrapper svg {
    width: 16px;
    height: 16px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    margin-top: 12px;
    letter-spacing: -0.02em;
    overflow-wrap: break-word;
}

.stat-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.card-content {
    padding: 24px;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.chart-card {
    min-height: 380px;
}

.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

.lg\:col-span-2 {
    grid-column: span 2;
}

/* Helper Utilities */
.mt-6 { margin-top: 24px; }
.mt-4 { margin-top: 16px; }
.mb-6 { margin-bottom: 24px; }
.mr-2 { margin-right: 8px; }
.w-full { width: 100%; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.items-center { align-items: center; }
.justify-start { justify-content: flex-start; }
.space-y-4 > * + * { margin-top: 16px; }
.space-y-3 > * + * { margin-top: 12px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-success {
    background-color: var(--success);
    color: #ffffff !important;
}

.btn-success:hover {
    background-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--text-muted);
}

[data-theme="light"] .btn-outline:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text);
    background-color: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .btn-ghost:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn i, .btn svg {
    width: 16px;
    height: 16px;
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.filters-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.filters-group .form-select {
    width: auto;
    min-width: 180px;
}

.text-nowrap {
    white-space: nowrap;
}

.search-box {
    position: relative;
    min-width: 280px;
    max-width: 480px;
    flex: 1;
}

.search-box i, .search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    background-color: var(--card-bg);
    border: 1px solid var(--input-border);
    color: var(--text);
    font-size: 14px;
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.2s ease;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
    min-width: 750px;
}

.data-table.compact {
    min-width: auto !important;
}

.data-table.compact th {
    padding: 10px 14px !important;
}

.data-table.compact td {
    padding: 10px 14px !important;
}

.data-table th {
    background-color: rgba(255, 255, 255, 0.02);
    padding: 14px 20px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

[data-theme="light"] .data-table th {
    background-color: rgba(0, 0, 0, 0.01);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

.data-table th.wrap-cell,
.data-table td.wrap-cell {
    white-space: normal;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

[data-theme="light"] .data-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.005);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 30px;
    line-height: 1;
}

.badge-secondary {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--border);
}

[data-theme="light"] .badge-secondary {
    background-color: rgba(0, 0, 0, 0.04);
}

.badge-success { background-color: var(--success-bg); color: var(--success); }
.badge-warning { background-color: var(--warning-bg); color: var(--warning); }
.badge-danger { background-color: var(--danger-bg); color: var(--danger); }
.badge-info { background-color: rgba(2, 132, 199, 0.1); color: var(--primary); }

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control, .form-select {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text);
    font-size: 14px;
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control[readonly], .form-control:disabled, .form-select:disabled {
    background-color: rgba(255, 255, 255, 0.02) !important;
    border-color: var(--border) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
    opacity: 0.8;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Elegant vertical separation between consecutive form elements (only vertically stacked, not side-by-side inside grid) */
:not(.form-grid) > .form-group + .form-group,
:not(.form-grid) > .form-group + .form-grid,
:not(.form-grid) > .form-grid + .form-group,
:not(.form-grid) > .form-grid + .form-grid {
    margin-top: 20px !important;
}

.col-span-2 {
    grid-column: span 2;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 100;
    display: none;
    place-items: center;
    padding: 20px;
    backdrop-filter: blur(6px);
    animation: fade-in-overlay 0.2s ease;
}

.modal-overlay.active {
    display: grid;
}

.modal {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 600px;
    animation: slide-up-modal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
}

.modal-sm {
    max-width: 440px;
}

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

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: grid;
    place-items: center;
    border-radius: 4px;
}

.modal-close:hover {
    color: var(--text);
    background-color: rgba(255, 255, 255, 0.05);
}

.modal-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.modal-content > .space-y-4 {
    overflow-y: auto;
    flex: 1;
    padding-right: 6px;
    margin-right: -6px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

@keyframes fade-in-overlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-up-modal {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Recent Orders List */
.recent-orders-list {
    display: flex;
    flex-direction: column;
}

.recent-order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.recent-order-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.recent-order-item:first-child {
    padding-top: 0;
}

.order-client-name {
    font-weight: 500;
    font-size: 14px;
}

.order-client-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.order-amount-box {
    text-align: right;
}

.order-amount {
    font-weight: 600;
    font-size: 14px;
}

/* Delivery UI */
.delivery-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    gap: 16px;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 16px;
}

.date-selector h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
}

.delivery-summary-badges {
    display: flex;
    gap: 8px;
}

.delivery-schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.delivery-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--border);
    background-color: rgba(255, 255, 255, 0.01);
    border-radius: var(--radius-md);
    gap: 16px;
    flex-wrap: wrap;
}

.delivery-item-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.delivery-item-icon {
    width: 38px;
    height: 38px;
    background-color: rgba(2, 132, 199, 0.1);
    color: var(--primary);
    border-radius: 8px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.delivery-item-icon i {
    width: 18px;
    height: 18px;
}

.delivery-customer-details h4 {
    font-size: 15px;
    font-weight: 600;
}

.delivery-customer-details p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.delivery-item-meta {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.delivery-qty-box {
    text-align: center;
}

.delivery-qty {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.delivery-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.delivery-actions {
    display: flex;
    gap: 8px;
}

/* Fleet Status */
.fleet-item {
    font-size: 14px;
}

.fleet-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fleet-driver {
    font-weight: 600;
}

.fleet-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar-wrapper {
    flex: 1;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

[data-theme="light"] .progress-bar-wrapper {
    background-color: rgba(0, 0, 0, 0.05);
}

.progress-bar {
    height: 100%;
    border-radius: 3px;
}

.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }

.progress-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 100px;
    text-align: right;
}

/* AI Predictions Stylings */
.bg-gradient-panel {
    background: linear-gradient(145deg, #111827, #0b1528);
    position: relative;
    border-color: rgba(2, 132, 199, 0.15);
}

.pulse-icon-container {
    width: 36px;
    height: 36px;
    background-color: rgba(2, 132, 199, 0.1);
    color: var(--primary);
    border-radius: 50%;
    display: grid;
    place-items: center;
    position: relative;
}

.pulse-icon {
    width: 18px;
    height: 18px;
    animation: rotate-icon 4s infinite linear;
}

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

.ai-box {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(2, 132, 199, 0.3);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.bg-dark-card {
    background-color: rgba(0, 0, 0, 0.2);
}

/* Toast Notifications Container */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 440px;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

[data-theme="light"] .toast {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.toast.active {
    transform: translateY(0);
    opacity: 1;
}

.toast.removing {
    transform: translateX(100%);
    opacity: 0;
}

.toast-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.toast-icon i {
    width: 20px;
    height: 20px;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--primary); }

.toast-message {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    color: var(--text);
}

.toast-close {
    cursor: pointer;
    color: var(--text-muted);
    display: grid;
    place-items: center;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toast-close:hover {
    color: var(--text);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-header {
        display: flex;
    }

    .mobile-page-title {
        display: block;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        z-index: 39;
        background-color: var(--card-bg);
        border-bottom: 1px solid var(--border);
        padding: 10px 16px;
    }

    .mobile-page-title h1 {
        font-size: 16px;
        font-weight: 700;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .top-navbar {
        display: none;
    }

    .main-content {
        padding: 126px 20px 20px 20px; /* offset for fixed mobile header + page title bar */
    }

    .lg\:col-span-2 {
        grid-column: span 1;
    }
}

.mobile-page-title {
    display: none;
}

@media (max-width: 768px) {
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .col-span-2 {
        grid-column: span 1;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .full-width-mobile {
        grid-column: span 2;
    }
}

/* Grid Layout & Utility Classes */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.gap-4 {
    gap: 16px;
}

.gap-6 {
    gap: 24px;
}

/* Responsive Grid columns */
@media (min-width: 640px) {
    .sm\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 768px) {
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .lg\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Spacing and Padding Utilities */
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-8 { padding-top: 32px; padding-bottom: 32px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.pt-4 { padding-top: 16px; }
.pb-4 { padding-bottom: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mr-1 { margin-right: 4px; }
.mr-2 { margin-right: 8px; }
.ml-1 { margin-left: 4px; }
.ml-2 { margin-left: 8px; }

.inline { display: inline; }
.inline-block { display: inline-block; }
.block { display: block; }
.hidden { display: none; }

.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }

.border-t { border-top: 1px solid var(--border); }
.rounded-lg { border-radius: var(--radius-md); }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }

/* Delivery Plan Switcher Tabs */
.delivery-plan-tabs {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.plan-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.plan-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.02);
}

.plan-tab.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .delivery-dashboard-header {
        flex-direction: column;
        align-items: stretch !important;
    }

    .delivery-plan-tabs {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding-left: 12px;
        padding-right: 12px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .data-table th {
        padding: 10px 12px;
        font-size: 10.5px;
    }

    .data-table td {
        padding: 10px 12px;
        font-size: 12.5px;
    }

    .modal {
        max-width: 100%;
    }

    .modal-overlay {
        padding: 12px;
    }

    .modal-content {
        padding: 16px;
    }

    .modal-header {
        padding: 16px;
    }

    .stat-value {
        font-size: 22px;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        top: 12px;
        align-items: stretch;
    }

    .toast {
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }
}

/* Modal Tabs System */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 20px;
    padding: 0 4px;
}

.modal-tab-btn {
    background: none;
    border: none;
    padding: 10px 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.modal-tab-btn:hover {
    color: var(--text);
}

.modal-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.modal-tab-content {
    display: none;
}

.modal-tab-content.active {
    display: block;
}

