:root {
    --primary: #2563eb;
    --success: #16a34a;
    /* Green for collecting money */
    --danger: #dc2626;
    /* Red for paying money */
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #1f2937;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo {
    font-weight: bold;
    font-size: 1.2rem;
}

main {
    padding: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.view.hidden {
    display: none;
}

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

.card {
    background: var(--card);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    box-sizing: border-box;
}

.row {
    display: flex;
    gap: 0.5rem;
}

.btn {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:active {
    opacity: 0.8;
}

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* Money Flows */
.money-flow {
    display: flex;
    justify-content: space-between;
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.pay-business {
    color: var(--danger);
    font-weight: bold;
}

.collect-client {
    color: var(--success);
    font-weight: bold;
}

.profit {
    color: var(--primary);
    font-weight: bold;
}

/* Driver Stats */
.stats-bar {
    display: flex;
    justify-content: space-between;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-weight: bold;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    padding: 0.5rem;
    background: #e5e7eb;
    border: none;
    border-radius: 0.5rem;
    font-weight: bold;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

/* Order Item */
.order-item {
    border-left: 4px solid var(--primary);
}

.order-item h4 {
    margin: 0 0 0.5rem 0;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    background: #eee;
    color: #666;
}

.status-assigned {
    background: #dbf4ff;
    color: #0077b6;
}

.status-picked_up {
    background: #fff3cd;
    color: #856404;
}

.status-delivered {
    background: #d4edda;
    color: #155724;
}

/* Map Styles */
#map {
    height: 300px;
    width: 100%;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    z-index: 1;
}

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 0.25rem;
}

.suggestions-list.hidden {
    display: none !important;
}

.suggestion-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.suggestion-item:hover {
    background-color: #f3f4f6;
}

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

#route-info {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Route Optimization Modal */
.route-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.route-modal.hidden {
    display: none !important;
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--primary);
    color: white;
}

.route-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.route-stats {
    display: flex;
    gap: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.route-legend {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    flex-wrap: wrap;
}

.marker-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.marker-dot.green {
    background: #28a745;
}

.marker-dot.orange {
    background: #fd7e14;
}

.marker-dot.gray {
    background: #6c757d;
}

/* KPI Cards */
.kpi-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* KPI Styles */
.kpi-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: bold;
    color: #1e293b;
    margin: 0.25rem 0;
}

.kpi-sublabel {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Modern Admin Dashboard Styles */
.dashboard-header {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #f1f5f9;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.kpi-title {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.kpi-value {
    color: #1e293b;
    font-size: 2rem;
    font-weight: 700;
}

.kpi-icon {
    float: right;
    font-size: 1.5rem;
    opacity: 0.8;
    padding: 10px;
    border-radius: 12px;
}

.kpi-blue {
    background: #eff6ff;
    color: #3b82f6;
}

/* Orders */
.kpi-green {
    background: #f0fdf4;
    color: #22c55e;
}

/* Businesses */
.kpi-yellow {
    background: #fefce8;
    color: #eab308;
}

/* Drivers */
.kpi-purple {
    background: #faf5ff;
    color: #a855f7;
}

/* Users */

.admin-table-container {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.modern-table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.modern-table tr:last-child td {
    border-bottom: none;
}

.modern-table tr:hover td {
    background: #f8fafc;
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-admin {
    background: #fee2e2;
    color: #ef4444;
}

.badge-business {
    background: #dbeafe;
    color: #3b82f6;
}

.badge-driver {
    background: #fef9c3;
    color: #d97706;
}

.badge-superadmin {
    background: #f3e8ff;
    color: #9333ea;
}

.badge-client {
    background: #f1f5f9;
    color: #64748b;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 4px;
}

.btn-edit {
    background: #e0f2fe;
    color: #0284c7;
}

.btn-edit:hover {
    background: #bae6fd;
}

.btn-delete {
    background: #fee2e2;
    color: #ef4444;
}

.btn-delete:hover {
    background: #fecaca;
}

/* Modern Login Form Styles */
#login-view {
    max-width: 420px;
    margin: 0 auto;
}

#login-view .card {
    background: white;
    border-radius: 20px;
    padding: 3rem 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#login-view h2 {
    text-align: center;
    color: #2d3748;
    margin-bottom: 2rem;
    font-size: 1.75rem;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

#login-form input {
    padding: 1rem 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f7fafc;
}

#login-form input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#login-form input::placeholder {
    color: #a0aec0;
}

#login-form button {
    margin-top: 0.5rem;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#login-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

#login-form button:active {
    transform: translateY(0);
}

.filter-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.filter-tab:hover {
    color: #334155;
    background: white;
}

.filter-tab.active {
    background: white;
    color: #0f172a;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
/* Status Canceled */
.status-canceled, .status-cancelled {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

/* Order Notes */
.order-notes {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #3b82f6;
    padding: 0.75rem;
    margin-top: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #475569;
}

.order-notes strong {
    color: #1e293b;
    font-weight: 600;
    margin-right: 0.25rem;
}
