:root {
    --primary: linear-gradient(135deg, #1e293b, #0f172a);
    --accent: #2563eb;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #1d4ed8);
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #34d399, #059669);
    --warning: #f59e0b;
    --warning-gradient: linear-gradient(135deg, #fbbf24, #d97706);
    --danger: #ef4444;
    --danger-gradient: linear-gradient(135deg, #f87171, #dc2626);
    --purple: #8b5cf6;
    --purple-gradient: linear-gradient(135deg, #a78bfa, #7c3aed);
    --bg: #f1f5f9;
    --card-bg: linear-gradient(145deg, #ffffff, #f8fafc);
    --text-color: #1e293b;
    --border-color: #cbd5e1;
    --shadow-3d: 0 10px 25px -5px rgba(37, 99, 235, 0.15), 0 8px 10px -6px rgba(37, 99, 235, 0.1);
}

body.dark-mode {
    --bg: #090d16;
    --card-bg: linear-gradient(145deg, #1e293b, #0f172a);
    --text-color: #f8fafc;
    --border-color: #334155;
    --shadow-3d: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

body.theme-emerald { --accent: #059669; --accent-gradient: linear-gradient(135deg, #10b981, #047857); --primary: linear-gradient(135deg, #064e3b, #022c22); --bg: #ecfdf5; }
body.theme-amber { --accent: #d97706; --accent-gradient: linear-gradient(135deg, #fbbf24, #b45309); --primary: linear-gradient(135deg, #78350f, #451a03); --bg: #fffbeb; }
body.theme-purple { --accent: #7c3aed; --accent-gradient: linear-gradient(135deg, #a78bfa, #6d28d9); --primary: linear-gradient(135deg, #4c1d95, #2e1065); --bg: #f5f3ff; }
body.theme-dark-pure { --bg: #000000; --card-bg: linear-gradient(145deg, #121212, #1a1a1a); --text-color: #e0e0e0; --border-color: #333333; }
body.theme-light-pure { --bg: #ffffff; --card-bg: linear-gradient(145deg, #ffffff, #f1f5f9); --text-color: #0f172a; --border-color: #cbd5e1; }

* { box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg); color: var(--text-color); padding: 12px; padding-bottom: 95px; padding-top: env(safe-area-inset-top, 12px); direction: rtl; transition: background 0.3s, color 0.3s; }

.app-3d-logo-container { text-align: center; margin: 6px 0 12px 0; perspective: 1000px; }
.logo-3d {
    display: inline-block; 
    background: linear-gradient(135deg, var(--accent), #1e293b, #3b82f6);
    color: #ffffff; padding: 10px 20px; border-radius: 14px; font-size: 15px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 1.5px;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.4), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3); position: relative;
    transform: rotateX(5deg);
}
.logo-3d::before { content: "🐎 "; font-size: 16px; }
.logo-3d span { color: #38bdf8; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }

.theme-selector-bar { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.theme-btn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; box-shadow: 0 4px 8px rgba(0,0,0,0.3); transition: transform 0.2s; }
.theme-btn:hover { transform: scale(1.15); }

.news-ticker {
    background: var(--card-bg); color: #38bdf8; padding: 8px 12px; border-radius: 8px;
    font-size: 12px; margin-bottom: 12px; border-right: 5px solid var(--accent); overflow: hidden; white-space: nowrap;
    box-shadow: var(--shadow-3d); border: 1px solid var(--border-color);
}
.news-ticker marquee { font-weight: bold; }

#lock-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(7, 11, 20, 0.96); z-index: 9999; display: flex;
    flex-direction: column; justify-content: center; align-items: center; color: white; padding: 16px; overflow-y: auto;
    backdrop-filter: blur(14px);
}
.login-gateway-box {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 22px;
    padding: 24px 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0,0,0,0.7), 0 0 35px rgba(37,99,235,0.25);
}
.login-gateway-box input {
    width: 100%; text-align: center; font-size: 13px; margin: 6px 0; padding: 11px; border-radius: 10px; 
    border: 1px solid rgba(255,255,255,0.15); background: rgba(15,23,42,0.85); color: #fff; box-shadow: inset 0 2px 5px rgba(0,0,0,0.4);
}
.login-gateway-box input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 15px rgba(59,130,246,0.4); }

.login-btn-group { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.login-btn-group button {
    width: 100%; padding: 11px; border-radius: 10px; font-size: 11px; font-weight: bold; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px; transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.login-btn-group button:hover { transform: translateY(-2px); }

#visitor-booking-container, #driver-register-container, .custom-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.9); z-index: 10000; justify-content: center; align-items: center; padding: 15px; overflow-y: auto;
    backdrop-filter: blur(5px);
}

header { 
    background: var(--primary); color: #fff; padding: 14px; border-radius: 12px; margin-bottom: 12px;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2), inset 0 1px 1px rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.1);
}

.alert-banner { background: var(--danger-gradient); color: white; padding: 8px; border-radius: 8px; font-size: 11px; margin-bottom: 8px; font-weight: bold; display: none; box-shadow: 0 4px 12px rgba(239,68,68,0.3); }
.cloud-badge { background: var(--success-gradient); color: white; padding: 5px 10px; border-radius: 20px; font-size: 10px; font-weight: bold; box-shadow: 0 4px 10px rgba(16,185,129,0.3); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat-card { 
    background: var(--card-bg); padding: 10px; border-radius: 10px; border-right: 5px solid var(--accent); 
    text-align: center; box-shadow: var(--shadow-3d); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    border-top: 1px solid var(--border-color); border-left: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: 0 15px 30px rgba(0,0,0,0.15); }
.stat-card h4 { font-size: 10px; opacity: 0.85; }
.stat-card p { font-size: 12px; font-weight: bold; margin-top: 4px; color: var(--accent); }

.search-box { width: 100%; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 10px; margin-bottom: 12px; font-size: 12px; background: var(--card-bg); color: var(--text-color); box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }

.sidebar-toggle-btn { background: var(--accent-gradient); color: white; border: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 11px; display: flex; align-items: center; gap: 4px; box-shadow: 0 4px 12px rgba(37,99,235,0.3); }

.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); z-index: 10001; display: none;
    backdrop-filter: blur(3px); transition: opacity 0.3s ease;
}
.sidebar-overlay.open { display: block; }

.sidebar-menu {
    position: fixed; top: 0; right: -320px; width: 290px; height: 100%;
    background: var(--card-bg); color: var(--text-color); z-index: 10002;
    box-shadow: -10px 0 30px rgba(0,0,0,0.4); transition: right 0.3s ease;
    display: flex; flex-direction: column; padding: 16px; overflow-y: auto;
    border-left: 1px solid var(--border-color);
}
.sidebar-menu.open { right: 0; }

.sidebar-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; border-bottom: 2px solid var(--border-color); padding-bottom: 10px;
}
.sidebar-header h3 { font-size: 15px; color: var(--accent); }

.sidebar-nav-list { display: flex; flex-direction: column; gap: 8px; }
.sidebar-nav-list button {
    background: var(--bg); color: var(--text-color); border: 1px solid var(--border-color); padding: 10px 14px;
    border-radius: 8px; cursor: pointer; text-align: right; font-weight: bold; font-size: 11px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03); transition: all 0.2s;
}
.sidebar-nav-list button:hover, .sidebar-nav-list button.active { background: var(--accent-gradient); color: white; transform: translateX(-4px); box-shadow: 0 6px 15px rgba(37,99,235,0.3); }

.bottom-nav-bar {
    position: fixed; bottom: 0; left: 0; width: 100%;
    background: var(--card-bg); border-top: 1px solid var(--border-color);
    display: flex; justify-content: space-around; align-items: center;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px)) 4px; z-index: 999; box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
}
.bottom-nav-btn {
    background: transparent; border: none; color: var(--text-color);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 9px; font-weight: bold; cursor: pointer; padding: 4px; flex: 1;
    transition: color 0.2s, transform 0.2s;
}
.bottom-nav-btn span { font-size: 16px; }
.bottom-nav-btn.active, .bottom-nav-btn:hover { color: var(--accent); transform: translateY(-2px); }

.app-section { display: none; }
.app-section.active { display: block; animation: fadeInPage 0.3s ease-in-out; }
@keyframes fadeInPage { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.card { 
    background: var(--card-bg); padding: 16px; border-radius: 12px; 
    box-shadow: var(--shadow-3d); margin-bottom: 12px; border: 1px solid var(--border-color); 
    position: relative; overflow: hidden;
}
.card::after {
    content: ""; position: absolute; top: 0; right: 0; width: 100%; height: 3px;
    background: var(--accent-gradient); opacity: 0.8;
}
.card h3 { margin-bottom: 10px; font-size: 14px; border-bottom: 2px solid var(--border-color); padding-bottom: 6px; color: var(--accent); }

input, select, textarea, button { width: 100%; padding: 9px 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 11px; background: var(--card-bg); color: var(--text-color); margin-bottom: 8px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.04); }

.btn-main { background: var(--accent-gradient); color: white; border: none; font-weight: bold; cursor: pointer; box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.btn-success { background: var(--success-gradient); color: white; border: none; font-weight: bold; cursor: pointer; box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.btn-danger { background: var(--danger-gradient); color: white; border: none; font-weight: bold; cursor: pointer; box-shadow: 0 4px 12px rgba(239,68,68,0.3); }
.btn-warning { background: var(--warning-gradient); color: white; border: none; font-weight: bold; cursor: pointer; box-shadow: 0 4px 12px rgba(245,158,11,0.3); }
.btn-purple { background: var(--purple-gradient); color: white; border: none; font-weight: bold; cursor: pointer; box-shadow: 0 4px 12px rgba(139,92,246,0.3); }
.btn-sm { padding: 5px 10px; font-size: 10px; width: auto; display: inline-block; margin: 2px; border-radius: 6px; }

.table-responsive { overflow-x: auto; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
table { width: 100%; border-collapse: collapse; margin-top: 6px; background: var(--card-bg); }
table th, table td { border: 1px solid var(--border-color); padding: 8px; text-align: center; font-size: 10px; }
table th { background: var(--accent-gradient); color: white; font-weight: bold; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
table tr:nth-child(even) { background: rgba(0,0,0,0.02); }

#signature-pad { border: 2px dashed var(--border-color); border-radius: 8px; background: #fff; width: 100%; height: 80px; touch-action: none; box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); }
.badge { padding: 3px 8px; border-radius: 10px; font-size: 9px; font-weight: bold; color: white; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

.bg-pending { background: var(--warning-gradient); }
.bg-transit { background: var(--accent-gradient); }
.bg-delivered { background: var(--success-gradient); }
.bg-returned { background: var(--danger-gradient); }

#map { height: 300px; width: 100%; border-radius: 10px; margin-top: 10px; border: 2px solid var(--border-color); box-shadow: var(--shadow-3d); }

.gplus-profile-card { background: var(--card-bg); border-radius: 14px; overflow: hidden; border: 1px solid var(--border-color); margin-bottom: 14px; box-shadow: var(--shadow-3d); }
.gplus-cover-banner { width: 100%; height: 180px; background-size: cover; background-position: center; background: var(--accent-gradient); position: relative; transition: height 0.2s ease; }
.gplus-cover-upload-btn { position: absolute; bottom: 10px; left: 10px; background: rgba(0,0,0,0.7); color: #fff; padding: 5px 10px; border-radius: 8px; font-size: 9px; cursor: pointer; border: 1px solid rgba(255,255,255,0.4); backdrop-filter: blur(4px); }

.gplus-profile-header-area { padding: 0 16px 16px 16px; position: relative; display: flex; flex-direction: column; gap: 8px; }
.gplus-avatar-wrapper { width: 90px; height: 90px; border-radius: 50%; border: 4px solid var(--card-bg); overflow: hidden; position: absolute; top: -50px; right: 16px; background: #cbd5e1; box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.gplus-avatar-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.gplus-avatar-upload-label { position: absolute; bottom: 0; width: 100%; background: rgba(0,0,0,0.7); color: white; font-size: 8px; text-align: center; cursor: pointer; padding: 2px; }

.gplus-profile-info { margin-top: 42px; }
.gplus-profile-name { font-size: 17px; font-weight: bold; color: var(--text-color); display: flex; align-items: center; gap: 8px; }
.gplus-profile-tagline { font-size: 11px; opacity: 0.85; margin-top: 4px; }
.gplus-stats-bar { display: flex; gap: 15px; margin-top: 12px; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); padding: 10px 0; font-size: 11px; }
.gplus-stat-item { text-align: center; flex: 1; }
.gplus-stat-item span { display: block; font-weight: bold; color: var(--accent); font-size: 14px; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }

.driver-search-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.driver-card-item { background: var(--bg); border: 1px solid var(--border-color); border-radius: 10px; padding: 12px; display: flex; gap: 10px; align-items: center; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.03); }
.driver-card-item:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 20px rgba(37,99,235,0.15); }
.driver-card-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); background: #cbd5e1; display: flex; justify-content: center; align-items: center; font-size: 15px; font-weight: bold; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.driver-card-avatar img { width: 100%; height: 100%; object-fit: cover; }

.chat-layout { display: grid; grid-template-columns: 250px 1fr; gap: 10px; height: 400px; }
@media(max-width: 768px) { .chat-layout { grid-template-columns: 1fr; height: auto; } }

.chat-sidebar-accounts { border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg); padding: 8px; overflow-y: auto; max-height: 400px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.03); }
.chat-account-item { padding: 8px 10px; border-radius: 6px; cursor: pointer; margin-bottom: 6px; font-size: 11px; display: flex; justify-content: space-between; align-items: center; background: var(--card-bg); border: 1px solid var(--border-color); transition: all 0.2s; }
.chat-account-item:hover, .chat-account-item.active { background: var(--accent-gradient); color: white; border-color: transparent; box-shadow: 0 4px 12px rgba(37,99,235,0.3); }

.chat-main-box { display: flex; flex-direction: column; height: 400px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg); overflow: hidden; box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); }
.chat-messages { flex: 1; padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-bubble { max-width: 75%; padding: 8px 12px; border-radius: 10px; font-size: 11px; line-height: 1.4; position: relative; box-shadow: 0 3px 8px rgba(0,0,0,0.08); }
.chat-bubble.admin { background: var(--accent-gradient); color: white; align-self: flex-start; border-bottom-right-radius: 0; }
.chat-bubble.driver { background: #334155; color: white; align-self: flex-end; border-bottom-left-radius: 0; }
.chat-input-area { display: flex; padding: 8px; background: var(--card-bg); border-top: 1px solid var(--border-color); gap: 6px; }

.load-post-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-3d); }
.load-post-media { display: flex; gap: 12px; margin-top: 10px; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 8px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.load-post-media::-webkit-scrollbar { height: 6px; }
.load-post-media::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
.load-post-media img, .load-post-media video { 
    width: 220px; height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border-color); 
    cursor: pointer; flex-shrink: 0; box-shadow: 0 6px 18px rgba(0,0,0,0.15); transition: transform 0.2s, box-shadow 0.2s; 
}
.load-post-media img:hover { transform: scale(1.02); box-shadow: 0 8px 22px rgba(37,99,235,0.3); }

.notification-badge-container { position: relative; display: inline-block; }
.notif-count-badge { position: absolute; top: -6px; right: -6px; background: var(--danger-gradient); color: white; border-radius: 50%; padding: 3px 6px; font-size: 8px; font-weight: bold; box-shadow: 0 2px 5px rgba(239,68,68,0.4); }
.community-feed-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px; padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow-3d); }

.wallet-box {
    background: linear-gradient(135deg, #10b981, #047857); color: white; padding: 12px; border-radius: 10px; margin-bottom: 10px;
    font-size: 11px; text-align: center; font-weight: bold; box-shadow: 0 4px 15px rgba(16,185,129,0.3);
}
