/* vAutoStock Design System — https://vautonest.com/feed/design-system */
:root {
  --vas-primary: #175cff;
  --vas-primary-light: #4a7fff;
  --vas-primary-dark: #0d47cc;
  --vas-secondary: #32373c;
  --vas-secondary-light: #4a5058;
  --vas-accent: #f2295b;
  --vas-accent-light: #ff4d7a;
  --vas-success: #28a745;
  --vas-warning: #ffc107;
  --vas-error: #dc3545;
  --vas-info: #17a2b8;
  --vas-gray-50: #f8f9fa;
  --vas-gray-100: #f1f3f5;
  --vas-gray-200: #e9ecef;
  --vas-gray-300: #dee2e6;
  --vas-gray-400: #ced4da;
  --vas-gray-500: #adb5bd;
  --vas-gray-600: #6c757d;
  --vas-gray-700: #495057;
  --vas-gray-800: #343a40;
  --vas-gray-900: #212529;
  --vas-border-radius: 8px;
  --vas-border-radius-lg: 12px;
  --vas-border-radius-full: 9999px;
  --vas-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  --vas-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --vas-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --vas-transition: all 0.2s ease-in-out;
  --vas-bg: var(--vas-gray-50);
  --vas-surface: #ffffff;
  --vas-border: var(--vas-gray-300);
  --vas-text: var(--vas-gray-900);
  --vas-text-secondary: var(--vas-gray-600);
  --vas-text-tertiary: var(--vas-gray-500);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--vas-bg);
  color: var(--vas-text);
  min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--vas-secondary);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo-img { height: 28px; width: auto; }

.sidebar-logo-text { font-size: 16px; font-weight: 700; }
.sidebar-logo-text span { color: var(--vas-primary-light); }

.sidebar-nav { list-style: none; padding: 12px 0; flex: 1; }

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--vas-transition);
  cursor: pointer;
}

.sidebar-nav li a:hover { color: white; background: rgba(255,255,255,0.08); }
.sidebar-nav li a.active {
  color: white;
  background: rgba(23,92,255,0.2);
  border-left: 3px solid var(--vas-primary);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.sidebar-email { margin-bottom: 8px; }
.sidebar-logout { color: var(--vas-accent-light); text-decoration: none; font-size: 12px; }

/* Main content */
.main { flex: 1; margin-left: 240px; padding: 24px 32px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title { font-size: 24px; font-weight: 600; }

/* Cards */
.card {
  background: var(--vas-surface);
  border-radius: var(--vas-border-radius-lg);
  border: 1px solid var(--vas-border);
  box-shadow: var(--vas-shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title { font-size: 14px; font-weight: 600; color: var(--vas-text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--vas-surface);
  border-radius: var(--vas-border-radius-lg);
  border: 1px solid var(--vas-border);
  padding: 20px;
  box-shadow: var(--vas-shadow);
}

.stat-card .stat-label { font-size: 13px; color: var(--vas-text-secondary); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-sub { font-size: 12px; color: var(--vas-text-tertiary); margin-top: 4px; }

/* Tables */
.table-container { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

table thead th {
  background: var(--vas-bg);
  color: var(--vas-text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--vas-border);
}

table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--vas-border);
  vertical-align: middle;
}

table tbody tr:hover { background: var(--vas-bg); }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-intro { background: #FFF3CD; color: #856404; }
.badge-active { background: #D4EDDA; color: #155724; }
.badge-cancelled { background: #F8D7DA; color: #721C24; }
.badge-suspended { background: #FFE0E0; color: #CC0000; }
.badge-annual { background: #D1ECF1; color: #0C5460; }
.badge-monthly { background: #E2E3E5; color: #383D41; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--vas-border-radius);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--vas-transition);
}

.btn-primary { background: var(--vas-primary); color: white; }
.btn-primary:hover { background: var(--vas-primary-dark); }
.btn-secondary { background: var(--vas-bg); color: var(--vas-text); border: 1px solid var(--vas-border); }
.btn-secondary:hover { background: var(--vas-border); }
.btn-accent { background: var(--vas-accent); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 12px; }
.btn-resend { margin-top: 8px; padding: 10px; }

/* Pages */
.page { display: none; }
.page.active { display: block; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--vas-text-tertiary); }

/* Messages */
.error-msg { background: #FEF2F2; border: 1px solid #FECACA; color: var(--vas-error); padding: 12px 16px; border-radius: var(--vas-border-radius); margin-bottom: 16px; font-size: 14px; }
.success-msg { background: #D4EDDA; border: 1px solid #C3E6CB; color: #155724; padding: 12px 16px; border-radius: var(--vas-border-radius); margin-bottom: 16px; font-size: 14px; }
.text-muted { color: var(--vas-text-secondary); }

/* Tenant detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item { margin-bottom: 12px; }
.detail-label { font-size: 12px; color: var(--vas-text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.detail-value { font-size: 15px; font-weight: 500; }

/* Login form */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--vas-bg);
}

.login-card {
  background: var(--vas-surface);
  border-radius: var(--vas-border-radius-lg);
  box-shadow: var(--vas-shadow-md);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-header { text-align: center; margin-bottom: 24px; }
.login-logo { height: 56px; width: auto; margin-bottom: 12px; }
.login-card h2 { margin-bottom: 8px; }
.login-card p { color: var(--vas-text-secondary); margin-bottom: 24px; font-size: 14px; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; }

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--vas-border);
  border-radius: var(--vas-border-radius);
  font-size: 14px;
  background: var(--vas-bg);
  transition: var(--vas-transition);
}

.form-input:focus { outline: none; border-color: var(--vas-primary); box-shadow: 0 0 0 3px rgba(23,92,255,0.1); }

.verify-hint { color: var(--vas-text-secondary); margin-bottom: 20px; font-size: 14px; }
.verify-code-input { text-align: center; font-size: 24px; letter-spacing: 8px; }

/* Health status */
.health-online { color: var(--vas-success); font-weight: 600; }
.health-timestamp { margin-left: 20px; color: var(--vas-text-secondary); font-size: 13px; }

/* Breadcrumb */
.breadcrumb-link { color: var(--vas-primary); text-decoration: none; }

/* Admin form grid */
.add-admin-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.add-admin-buttons { display: flex; gap: 8px; }

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.modal-card {
  background: var(--vas-surface);
  border-radius: var(--vas-border-radius-lg);
  box-shadow: var(--vas-shadow-lg);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 { font-size: 18px; font-weight: 600; }

/* Flag row */
.flag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--vas-gray-200);
  cursor: pointer;
}

.flag-row:hover { background: var(--vas-bg); margin: 0 -20px; padding: 12px 20px; }

.flag-info { flex: 1; }
.flag-name { font-size: 14px; font-weight: 600; }
.flag-key { font-size: 12px; color: var(--vas-text-tertiary); }
.flag-counts { font-size: 13px; color: var(--vas-text-secondary); margin-right: 16px; }

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--vas-gray-400);
  border-radius: 12px;
  transition: 0.2s;
  cursor: pointer;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider { background: var(--vas-success); }
.toggle-switch input:checked + .toggle-slider:before { left: 22px; }

/* Billing event list */
.event-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--vas-gray-200);
  font-size: 13px;
}

.event-item:last-child { border-bottom: none; }
.event-time { color: var(--vas-text-tertiary); white-space: nowrap; min-width: 120px; }
.event-type { font-weight: 600; min-width: 100px; }
.event-desc { color: var(--vas-text-secondary); flex: 1; }
.event-by { color: var(--vas-text-tertiary); font-size: 12px; }

/* Badge additions */
.badge-past_due { background: #FFF3CD; color: #856404; }

/* Select input */
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--vas-border);
  border-radius: var(--vas-border-radius);
  font-size: 14px;
  background: var(--vas-bg);
  transition: var(--vas-transition);
  cursor: pointer;
}

.form-select:focus { outline: none; border-color: var(--vas-primary); box-shadow: 0 0 0 3px rgba(23,92,255,0.1); }
