/* ==========================================================================
   ASLAN CLEANING SYSTEM - STYLESHEET (GLASSMORPHISM & MODERN DARK UI)
   ========================================================================== */

:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --border-glass: rgba(255, 255, 255, 0.1);
  --border-gold: rgba(217, 119, 6, 0.4);
  
  --color-primary: #3b82f6;
  --color-primary-light: #60a5fa;
  --color-accent: #f59e0b;
  --color-gold: #fbbf24;
  --color-success: #10b981;
  --color-warning: #f97316;
  --color-danger: #ef4444;
  --color-purple: #8b5cf6;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
  --font-family: 'Cairo', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.bg-dark {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(217, 119, 6, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  line-height: 1.6;
}

/* THEME DIRECTION */
.theme-rtl { dir: rtl; text-align: right; }
.theme-ltr { dir: ltr; text-align: left; }

/* HEADER & NAV */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-img {
  height: 42px;
  width: 42px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--color-gold);
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.4);
}

.brand-titles h1 {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.4rem 0.8rem;
  border-radius: 30px;
  border: 1px solid var(--border-glass);
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.user-info-text {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
}

.user-role-badge {
  font-size: 0.65rem;
}

/* MAIN LAYOUT */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* GLASS CARDS */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-glass);
}

.card-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ROLE VIEWS CONTROLLER */
.role-view {
  display: none;
}

.role-view.active {
  display: block;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* LOGIN SCREEN */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}

.login-card {
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.login-logo-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--color-gold);
  margin-bottom: 1rem;
  box-shadow: 0 0 20px rgba(217, 119, 6, 0.5);
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.sub-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.login-form {
  margin-top: 1.5rem;
  text-align: right;
}

.quick-btns {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: rgba(15, 23, 42, 0.9);
}

.input-with-btn {
  display: flex;
  gap: 0.5rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row > * {
  flex: 1;
}

.flex-2 { flex: 2; }
.flex-3 { flex: 3; }

/* BUTTONS */
button, .btn {
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  padding: 0.75rem 1.25rem;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #fff;
  padding: 0.5rem 1rem;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.4);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.5rem 1rem;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-block { width: 100%; }
.btn-lg { padding: 0.9rem 1.5rem; font-size: 1.05rem; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; border-radius: var(--radius-sm); }

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* BADGES */
.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.badge-primary { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-accent { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-success { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-warning { background: rgba(249, 115, 22, 0.2); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.4); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-purple { background: rgba(139, 92, 246, 0.2); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.4); }
.badge-info { background: rgba(14, 165, 233, 0.2); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.4); }

/* GRID LAYOUTS */
.view-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .view-grid {
    grid-template-columns: 1fr;
  }
}

.margin-top { margin-top: 1.5rem; }
.margin-bottom { margin-bottom: 1.5rem; }

/* CALL CENTER ITEMS & PRICING */
.carpet-item-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  background: rgba(15, 23, 42, 0.4);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  margin-bottom: 0.5rem;
}

.item-calc {
  font-weight: 700;
  color: var(--color-gold);
  min-width: 70px;
}

.btn-remove-item {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.order-pricing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: var(--radius-md);
}

.summary-item {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.summary-item.total-item strong {
  font-size: 1.25rem;
}

/* LEAFLET MAP CONTAINERS */
.leaflet-map-container {
  height: 250px;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.leaflet-map-container-lg {
  height: 500px;
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

/* DRIVER TABS & STATUS */
.driver-profile-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.driver-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.driver-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
}

.driver-status-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-group {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem;
  border-radius: var(--radius-md);
}

.btn-status {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
}

.btn-status.active-online { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.btn-status.active-offline { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.btn-status.active-busy { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.driver-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.driver-tab-btn {
  padding: 0.75rem 1.25rem;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.driver-tab-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary-light);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

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

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

.orders-grid-driver {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.driver-order-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
}

.distance-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.action-buttons-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn-action-icon {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  text-align: center;
  color: #fff;
}

.btn-call { background: #2563eb; }
.btn-whatsapp { background: #059669; }
.btn-nav { background: #d97706; }

/* METRICS GRID */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.bg-primary-light { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.bg-warning-light { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.bg-info-light { background: rgba(14, 165, 233, 0.2); color: #38bdf8; }
.bg-success-light { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.bg-accent-light { background: rgba(217, 119, 6, 0.2); color: #f59e0b; }

.metric-title {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.metric-data h3 {
  font-size: 1.4rem;
  font-weight: 800;
}

/* DATA TABLES */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-glass);
}

.data-table th {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

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

/* UTILS */
.text-gold { color: var(--color-gold); }
.text-primary { color: var(--color-primary-light); }
.hidden { display: none !important; }
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-md); font-size: 0.85rem; }
.alert-danger { background: rgba(239, 68, 68, 0.2); border: 1px solid rgba(239, 68, 68, 0.4); color: #f87171; }

/* MODALS & OVERLAYS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal-card {
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}