/* EasyWash Management — Main Stylesheet */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f5f5f5; }
.container { margin: 0; padding: 0; }
header { background: #2c3e50; color: white; padding: 20px; border-radius: 8px; margin-bottom: 20px; }
h1 { margin-bottom: 10px; }
.status { font-size: 14px; opacity: 0.9; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.card { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.card h2 { margin-bottom: 15px; color: #2c3e50; }
.card h3 { margin-bottom: 15px; color: #34495e; margin-top: 15px; }
.cards-list { list-style: none; }
.cards-list li { padding: 10px; background: #ecf0f1; margin: 8px 0; border-radius: 4px; }
.btn { padding: 10px 20px; background: #3498db; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; }
.btn:hover { background: #2980b9; }
.btn-small { padding: 6px 12px; font-size: 12px; margin: 2px; }
.vs-pill { display:inline-block; padding:8px 16px; border-radius:20px; font-size:13px; font-weight:bold; cursor:pointer; border:2px solid #bdc3c7; background:#fff; color:#7f8c8d; transition:all 0.2s ease; user-select:none; }
.vs-pill:hover { border-color:#95a5a6; transform:scale(1.05); }
input[name="vsServiceType"]:checked + .vs-pill { color:#fff; border-color:transparent; box-shadow:0 2px 8px rgba(0,0,0,0.2); transform:scale(1.05); }
.error { color: #e74c3c; }
.success { color: #27ae60; }

/* Tab content */
.tab-content { display: none; width: 100%; }

/* Sidebar layout */
.app-layout { display: flex; min-height: calc(100vh - 90px); }
.sidebar { width: 260px; min-width: 260px; background: #2c3e50; color: white; overflow-y: auto; transition: width 0.3s, min-width 0.3s; position: sticky; top: 0; height: calc(100vh - 90px); }
.sidebar.collapsed { width: 0; min-width: 0; overflow: hidden; padding: 0; }
.sidebar-toggle { background: #34495e; color: white; border: none; padding: 8px 14px; cursor: pointer; font-size: 20px; border-radius: 4px; line-height: 1; }
.sidebar-toggle:hover { background: #4a6785; }
.sidebar-section { border-bottom: 1px solid #34495e; }
.sidebar-section-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; cursor: pointer; font-weight: bold; font-size: 15px; user-select: none; transition: background 0.2s; }
.sidebar-section-header:hover { background: #34495e; }
.sidebar-section.easywash .sidebar-section-header { border-left: 4px solid #3498db; background: rgba(52,152,219,0.2); }
.sidebar-section.easywash .sidebar-section-header:hover { background: rgba(52,152,219,0.35); }
.sidebar-section.insurance .sidebar-section-header { border-left: 4px solid #e67e22; background: rgba(230,126,34,0.2); }
.sidebar-section.insurance .sidebar-section-header:hover { background: rgba(230,126,34,0.35); }
.sidebar-section.vehicleservice .sidebar-section-header { border-left: 4px solid #e74c3c; background: rgba(231,76,60,0.2); }
.sidebar-section.vehicleservice .sidebar-section-header:hover { background: rgba(231,76,60,0.35); }
.sidebar-section.drivinglicence .sidebar-section-header { border-left: 4px solid #16a085; background: rgba(22,160,133,0.2); }
.sidebar-section.drivinglicence .sidebar-section-header:hover { background: rgba(22,160,133,0.35); }
.sidebar-section.airticketing .sidebar-section-header { border-left: 4px solid #0984e3; background: rgba(9,132,227,0.2); }
.sidebar-section.airticketing .sidebar-section-header:hover { background: rgba(9,132,227,0.35); }
.sidebar-section-items { display: none; padding-bottom: 8px; }
.sidebar-section-items.open { display: block; }
.sidebar-chevron { font-size: 12px; transition: transform 0.2s; }
.sidebar-item { display: block; width: 100%; background: none; border: none; color: #bdc3c7; padding: 10px 16px 10px 28px; text-align: left; cursor: pointer; font-size: 14px; transition: all 0.2s; border-left: 3px solid transparent; }
.sidebar-item:hover { background: #34495e; color: white; }
.sidebar-item.active { background: #3498db; color: white; font-weight: bold; border-left-color: #fff; }
.sidebar-section.easywash .sidebar-item:hover { background: rgba(52,152,219,0.25); color: #fff; }
.sidebar-section.insurance .sidebar-item.active { background: #e67e22; border-left-color: #fff; }
.sidebar-section.insurance .sidebar-item:hover { background: rgba(230,126,34,0.25); color: #fff; }
.sidebar-section.vehicleservice .sidebar-item.active { background: #e74c3c; border-left-color: #fff; }
.sidebar-section.vehicleservice .sidebar-item:hover { background: rgba(231,76,60,0.25); color: #fff; }
.sidebar-section.drivinglicence .sidebar-item.active { background: #16a085; border-left-color: #fff; }
.sidebar-section.drivinglicence .sidebar-item:hover { background: rgba(22,160,133,0.25); color: #fff; }
.sidebar-section.airticketing .sidebar-item.active { background: #0984e3; border-left-color: #fff; }
.sidebar-section.airticketing .sidebar-item:hover { background: rgba(9,132,227,0.25); color: #fff; }
.sidebar-section.marketing .sidebar-section-header { border-left: 4px solid #e84393; background: rgba(232,67,147,0.2); }
.sidebar-section.marketing .sidebar-section-header:hover { background: rgba(232,67,147,0.35); }
.sidebar-section.marketing .sidebar-item.active { background: #e84393; border-left-color: #fff; }
.sidebar-section.marketing .sidebar-item:hover { background: rgba(232,67,147,0.25); color: #fff; }
.sidebar-section.staffperf .sidebar-section-header { border-left: 4px solid #9b59b6; background: rgba(155,89,182,0.2); }
.sidebar-section.staffperf .sidebar-section-header:hover { background: rgba(155,89,182,0.35); }
.sidebar-section.staffperf .sidebar-item.active { background: #9b59b6; border-left-color: #fff; }
.sidebar-section.staffperf .sidebar-item:hover { background: rgba(155,89,182,0.25); color: #fff; }
.main-content { flex: 1; padding: 20px; overflow-y: auto; min-width: 0; }

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  /* Sidebar: fixed overlay on mobile */
  .sidebar { position: fixed; z-index: 999; height: 100vh; top: 0; left: 0; }
  .sidebar.collapsed { width: 0; min-width: 0; }

  /* Header: stack items vertically, smaller text */
  header { padding: 10px 12px !important; }
  header h1 { font-size: 16px !important; }
  header .status { font-size: 11px !important; }
  header > div:last-child { gap: 4px !important; flex-wrap: wrap; }
  header > div:last-child > * { font-size: 11px !important; padding: 4px 8px !important; }

  /* Main content: reduce padding */
  .main-content { padding: 10px; }

  /* Grid layouts: single column */
  .grid, [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns:2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Tables: horizontal scroll */
  table { display: block; overflow-x: auto; white-space: nowrap; }
  th, td { padding: 8px; font-size: 12px; }

  /* Cards */
  .card { padding: 12px; }

  /* Buttons: touch-friendly sizing */
  .btn { padding: 10px 16px; font-size: 13px; min-height: 40px; }
  .btn-small { padding: 8px 12px; font-size: 12px; min-height: 36px; }

  /* Folder headers */
  .folder-header { padding: 12px; font-size: 14px; }
  .folder-icon { font-size: 22px; }

  /* Forms: full-width inputs */
  input, select, textarea { font-size: 16px !important; /* prevents zoom on iOS */ }

  /* Login box */
  .login-box { width: 90%; padding: 24px; }

  /* Quick stats grid: 2 columns on mobile */
  #dashQuickStats { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }

  /* Quick actions: wrap nicely */
  #dashQuickActions { gap: 6px !important; }
  #dashQuickActions > * { flex: 1 1 calc(50% - 6px); min-width: 0; font-size: 11px !important; }

  /* Chart section: single column on mobile */
  #dashChartsSection > div { grid-template-columns: 1fr !important; }

  /* WhatsApp Inbox: stack panels on mobile */
  #whatsapp-inbox > div:nth-child(2) { flex-direction: column !important; height: auto !important; min-height: calc(100vh - 200px); }
  #whatsapp-inbox > div:nth-child(2) > div:first-child { width: 100% !important; min-width: 0 !important; border-right: none !important; border-bottom: 1px solid #e0e0e0; max-height: none; }
  #whatsapp-inbox > div:nth-child(2) > div:first-child.wa-panel-hidden { display: none !important; }
  #whatsapp-inbox > div:nth-child(2) > div:last-child { min-height: 400px; }
  #whatsapp-inbox > div:nth-child(2) > div:last-child.wa-panel-hidden { display: none !important; }
  .wa-back-btn { display: flex !important; }
}

/* Extra small screens */
@media (max-width: 480px) {
  header h1 { font-size: 14px !important; }
  #dashQuickStats { grid-template-columns: repeat(2, 1fr) !important; }
  #dashQuickStats > div { padding: 10px !important; }
  #dashQuickStats > div > div:nth-child(2) { font-size: 20px !important; }

  /* Sidebar: narrower */
  .sidebar { width: 220px; min-width: 220px; }

  /* Client mode toggle: keep visible on mobile */
}

/* Table styles */
table { border-collapse: collapse; width: 100%; }
th, td { padding: 12px; text-align: left; border: 1px solid #bdc3c7; }
th { background: #34495e; color: white; }
tr:nth-child(even) { background: #f9f9f9; }
tr:hover { background: #ecf0f1; }

/* Status badges */
.status-badge { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: bold; }
.status-active { background: #d5f4e6; color: #27ae60; }
.status-paused { background: #ffeaa7; color: #f39c12; }
.status-cancelled { background: #fadbd8; color: #e74c3c; }

/* Folder styles */
.folder-header { display: flex; align-items: center; gap: 12px; padding: 15px; background: #3498db; color: white; border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: bold; margin-bottom: 15px; user-select: none; transition: all 0.3s; }
.folder-header:hover { background: #2980b9; }
.folder-icon { font-size: 28px; }
.folder-toggle { margin-left: auto; transition: transform 0.3s; }
.folder-toggle.open { transform: rotate(90deg); }
.folder-content { display: none; margin-bottom: 20px; width: 100%; }
.folder-content.open { display: block; }
.folder-content > .card { width: 100%; box-sizing: border-box; }

/* Login overlay */
#loginOverlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #2c3e50; z-index: 10000; display: flex; align-items: center; justify-content: center; }
.login-box { background: white; padding: 40px; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.3); width: 360px; text-align: center; }
.login-box h2 { color: #2c3e50; margin-bottom: 8px; }
.login-box p { color: #7f8c8d; margin-bottom: 24px; font-size: 14px; }
.login-box input { width: 100%; padding: 12px; margin-bottom: 12px; border: 1px solid #bdc3c7; border-radius: 6px; font-size: 14px; }
.login-box button { width: 100%; padding: 12px; background: #3498db; color: white; border: none; border-radius: 6px; font-size: 16px; cursor: pointer; font-weight: bold; }
.login-box button:hover { background: #2980b9; }
.login-box .login-error { color: #e74c3c; font-size: 13px; margin-top: 8px; min-height: 20px; }
.logout-btn { background: #e74c3c; color: white; border: none; padding: 6px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.logout-btn:hover { background: #c0392b; }
.sidebar-section.admin .sidebar-section-header { border-left: 4px solid #9b59b6; background: rgba(155,89,182,0.2); }
.sidebar-section.admin .sidebar-section-header:hover { background: rgba(155,89,182,0.35); }
.sidebar-section.admin .sidebar-item.active { background: #9b59b6; border-left-color: #fff; }
.sidebar-section.admin .sidebar-item:hover { background: rgba(155,89,182,0.25); color: #fff; }
.sidebar-section.expense .sidebar-section-header { border-left: 4px solid #00b894; background: rgba(0,184,148,0.2); }
.sidebar-section.expense .sidebar-section-header:hover { background: rgba(0,184,148,0.35); }
.sidebar-section.expense .sidebar-item.active { background: #00b894; border-left-color: #fff; }
.sidebar-section.expense .sidebar-item:hover { background: rgba(0,184,148,0.25); color: #fff; }

/* Sidebar section group headers */
body.client-mode .sensitive-data { display: none !important; }
.sidebar-group-label { padding: 10px 16px 6px 16px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #7f8c8d; border-top: 1px solid #3d566e; margin-top: 2px; user-select: none; }
.sidebar-group-label:first-child { border-top: none; margin-top: 0; }

/* Sidebar icons */
.sidebar-icon { margin-right: 8px; font-size: 16px; }
