/* 
 * Vehicle Management System (VMS) - Light Theme System
 * Bright & Clean Aesthetic with Custom Palette & Watermark Car Background
 * Palette: #A28EAD, #EDA0BB, #E25B7C, #F4906B, #3ABFBA, #00B5D8
 */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Light Theme Backgrounds */
  --bg-main: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-solid: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-input: #f8fafc;
  
  --border-color: #e2e8f0;
  --border-highlight: rgba(226, 91, 124, 0.45);

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* User Selected Color Palette */
  --lavender: #A28EAD;
  --rose-pink: #EDA0BB;
  --magenta: #E25B7C;
  --coral-orange: #F4906B;
  --turquoise: #3ABFBA;
  --cyan-blue: #00B5D8;

  /* Theme Mapping */
  --primary: #E25B7C;
  --primary-hover: #d04667;
  --primary-light: rgba(226, 91, 124, 0.12);

  --success: #149a95;
  --success-light: rgba(58, 191, 186, 0.18);
  
  --warning: #d97706;
  --warning-light: rgba(244, 144, 107, 0.18);

  --danger: #e11d48;
  --danger-light: rgba(225, 29, 72, 0.14);

  --info: #0284c7;
  --info-light: rgba(0, 181, 216, 0.15);

  --font-family: 'Kanit', 'Plus Jakarta Sans', sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(148, 163, 184, 0.12);
  --shadow-lg: 0 16px 32px rgba(148, 163, 184, 0.18);
  --shadow-glow: 0 4px 16px rgba(226, 91, 124, 0.25);

  --sidebar-width: 260px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  background-image: 
    linear-gradient(to bottom, rgba(241, 245, 249, 0.88), rgba(241, 245, 249, 0.93)),
    url('../images/car_bg_light.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* Sidebar Layout */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(0,0,0,0.03);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--magenta), var(--coral-orange));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

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

.sidebar-nav {
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 12px 14px 6px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.nav-link:hover {
  background: rgba(226, 91, 124, 0.08);
  color: var(--magenta);
  transform: translateX(4px);
}

.nav-link.active {
  background: linear-gradient(135deg, var(--magenta), var(--coral-orange));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(226, 91, 124, 0.3);
}

.nav-link i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.nav-link .badge {
  margin-left: auto;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Main Content Layout */
.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
}

.app-header {
  height: 70px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-header-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quick-alert-btn {
  position: relative;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
}

.quick-alert-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(226, 91, 124, 0.2);
}

.notif-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(225, 29, 72, 0.5);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: #f8fafc;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--turquoise), var(--cyan-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 0.9rem;
}

/* Page Body Container */
.content-wrapper {
  padding: 32px;
  flex: 1;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.metric-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-highlight);
  box-shadow: var(--shadow-md);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--card-accent, var(--primary));
}

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

.metric-title {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--icon-bg, var(--primary-light));
  color: var(--icon-color, var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.metric-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Banners / Alert Cards */
.alert-banner {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.08), rgba(244, 144, 107, 0.08));
  border: 1px solid rgba(225, 29, 72, 0.25);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

.alert-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.alert-banner-icon {
  font-size: 1.8rem;
  color: var(--danger);
}

.alert-banner-text h4 {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 600;
}

.alert-banner-text p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Glass Panels & Sections */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Charts Layout Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

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

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--magenta), var(--coral-orange));
  color: #fff;
  box-shadow: 0 4px 14px rgba(226, 91, 124, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #d04667, #e37c56);
  box-shadow: 0 6px 18px rgba(226, 91, 124, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f8fafc;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--turquoise), #2ca6a1);
  color: #fff;
}

.btn-success:hover {
  background: linear-gradient(135deg, #2ca6a1, #218c88);
}

.btn-danger {
  background: rgba(225, 29, 72, 0.1);
  border-color: rgba(225, 29, 72, 0.25);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(58, 191, 186, 0.35);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(244, 144, 107, 0.35);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(225, 29, 72, 0.35);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
  border: 1px solid rgba(0, 181, 216, 0.35);
}

.badge-secondary {
  background: #f1f5f9;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.custom-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.custom-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.custom-table tbody tr {
  transition: background 0.15s ease;
}

.custom-table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* Vehicles Grid Card Layout */
.vehicles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.vehicle-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.vehicle-card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.vehicle-img-wrap {
  height: 180px;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #e2e8f0;
}

.vehicle-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.vehicle-card:hover .vehicle-img-wrap img {
  transform: scale(1.05);
}

.vehicle-plate-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,0,0,0.1);
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.vehicle-status-tag {
  position: absolute;
  top: 14px;
  right: 14px;
}

.vehicle-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.vehicle-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.vehicle-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.doc-status-list {
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.82rem;
  border: 1px solid var(--border-color);
}

.doc-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vehicle-card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(20px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
}

/* Forms & Controls */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

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

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.92rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(226, 91, 124, 0.2);
  background: #ffffff;
}

select.form-control {
  cursor: pointer;
}

/* Toast Notification Popup */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  color: var(--text-primary);
  animation: slide-in 0.3s ease;
}

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}
