/**
 * Apex AutoCare CRM - Master Automotive Design System Stylesheet
 * Premium Automotive Workshop & Service Center Management UI
 */

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

:root {
  /* Automotive Color Palette */
  --auto-navy: #101827;
  --auto-navy-dark: #0B0F19;
  --auto-slate: #1E293B;
  --auto-slate-light: #334155;
  --auto-blue: #1677FF;
  --auto-blue-hover: #0958D9;
  --auto-cyan: #00C8E8;
  --auto-cyan-glow: rgba(0, 200, 232, 0.35);
  --auto-gold: #F59E0B;
  --auto-green: #10B981;
  --auto-red: #EF4444;
  --auto-purple: #8B5CF6;
  
  /* Surfaces & Backgrounds */
  --auto-bg: #F3F6FA;
  --auto-card-bg: #FFFFFF;
  --auto-sidebar-bg: #111827;
  --auto-topbar-bg: #FFFFFF;
  
  /* Typography & Borders */
  --auto-text-main: #1E293B;
  --auto-text-muted: #64748B;
  --auto-border: #E2E8F0;
  --auto-border-dark: #334155;
  
  /* Elevation & Shadows */
  --auto-shadow-sm: 0 1px 3px rgba(16, 24, 39, 0.04);
  --auto-shadow-md: 0 4px 16px -2px rgba(16, 24, 39, 0.06), 0 2px 6px -1px rgba(16, 24, 39, 0.03);
  --auto-shadow-lg: 0 10px 30px -3px rgba(16, 24, 39, 0.1), 0 4px 10px -2px rgba(16, 24, 39, 0.05);
  --auto-shadow-glow: 0 0 20px rgba(22, 119, 255, 0.25);
  
  /* Radii */
  --auto-radius-sm: 8px;
  --auto-radius-md: 12px;
  --auto-radius-lg: 16px;
  --auto-radius-pill: 9999px;
}

/* Global Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--auto-bg);
  color: var(--auto-text-main);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #F1F5F9;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* Code & Numbers Monospace */
.font-monospace {
  font-family: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
}

/* Layout Framework */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* ==========================================================================
   GLOBAL SIDEBAR (LUXURY COCKPIT THEME)
   ========================================================================== */
.app-sidebar {
  width: 270px;
  background: linear-gradient(180deg, #0F172A 0%, #111827 100%);
  color: #F8FAFC;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1030;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.sidebar-brand {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.sidebar-brand::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #1677FF 0%, #00C8E8 60%, transparent 100%);
}

.sidebar-brand a {
  text-decoration: none;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1677FF 0%, #00C8E8 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(22, 119, 255, 0.4);
  flex-shrink: 0;
}

.sidebar-brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #00C8E8;
  text-transform: uppercase;
}

.sidebar-menu {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.25rem 0.85rem;
}

.menu-category {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748B;
  padding: 1rem 0.85rem 0.35rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.menu-category::before {
  content: "//";
  color: #00C8E8;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.95rem;
  color: #94A3B8;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 9px;
  margin-bottom: 0.2rem;
  transition: all 0.18s ease;
  position: relative;
}

.nav-link-custom i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  color: #64748B;
  transition: color 0.18s ease, transform 0.18s ease;
}

.nav-link-custom:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #FFFFFF;
}

.nav-link-custom:hover i {
  color: #00C8E8;
  transform: translateX(2px);
}

.nav-link-custom.active {
  background: linear-gradient(135deg, rgba(22, 119, 255, 0.95) 0%, rgba(0, 200, 232, 0.85) 100%);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(22, 119, 255, 0.35);
}

.nav-link-custom.active i {
  color: #FFFFFF;
}

.nav-link-pos {
  background: linear-gradient(135deg, rgba(22, 119, 255, 0.15) 0%, rgba(0, 200, 232, 0.15) 100%);
  border: 1px solid rgba(0, 200, 232, 0.3);
  color: #38BDF8 !important;
  font-weight: 700;
}

.nav-link-pos:hover {
  background: linear-gradient(135deg, rgba(22, 119, 255, 0.3) 0%, rgba(0, 200, 232, 0.3) 100%);
  border-color: #00C8E8;
  color: #FFFFFF !important;
}

.sidebar-user {
  padding: 0.95rem 1.15rem;
  background: rgba(11, 15, 25, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #1677FF 0%, #00C8E8 100%);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0, 200, 232, 0.3);
  flex-shrink: 0;
}

/* ==========================================================================
   GLOBAL TOPBAR (NAVIGATION & COCKPIT CONTEXT)
   ========================================================================== */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--auto-bg);
}

.app-topbar {
  height: 72px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--auto-border);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 1px 4px rgba(16, 24, 39, 0.03);
}

.topbar-page-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-page-badge .page-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(22, 119, 255, 0.1);
  color: var(--auto-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.topbar-branch-selector {
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  padding: 0.4rem 0.8rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--auto-slate);
  background-color: #F8FAFC;
  transition: all 0.2s ease;
}

.topbar-branch-selector:focus {
  border-color: var(--auto-blue);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.15);
  background-color: #FFFFFF;
}

.btn-pos-shortcut {
  background: linear-gradient(135deg, #1677FF 0%, #00C8E8 100%);
  color: #FFFFFF !important;
  border: none;
  border-radius: 9px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 10px rgba(22, 119, 255, 0.35);
  transition: all 0.2s ease;
}

.btn-pos-shortcut:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(22, 119, 255, 0.5);
  color: #FFFFFF !important;
}

.content-body {
  padding: 1.5rem 1.75rem 3rem 1.75rem;
  flex-grow: 1;
}

/* ==========================================================================
   AUTOMOTIVE REUSABLE PAGE HEADER BANNER
   ========================================================================== */
.auto-page-header {
  background: linear-gradient(135deg, #101827 0%, #1E293B 100%);
  color: #FFFFFF;
  border-radius: var(--auto-radius-md);
  padding: 1.25rem 1.75rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--auto-shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auto-page-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #1677FF 0%, #00C8E8 60%, #10B981 100%);
}

.auto-page-header .header-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #38BDF8;
  text-transform: uppercase;
  width: fit-content;
}

.auto-page-header h4 {
  font-weight: 800;
  letter-spacing: -0.4px;
  margin: 0;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.auto-page-header p {
  color: #94A3B8;
  font-size: 0.88rem;
  margin: 0;
}

/* ==========================================================================
   STAT / METRIC CARDS (AUTOMOTIVE DIGITAL CLUSTER)
   ========================================================================== */
.auto-stat-card {
  background: #FFFFFF;
  border: 1px solid var(--auto-border);
  border-radius: var(--auto-radius-md);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--auto-shadow-sm);
  transition: all 0.2s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auto-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--auto-shadow-md);
  border-color: #CBD5E1;
}

.auto-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--card-accent, #1677FF);
}

.auto-stat-card.accent-blue { --card-accent: #1677FF; }
.auto-stat-card.accent-cyan { --card-accent: #00C8E8; }
.auto-stat-card.accent-green { --card-accent: #10B981; }
.auto-stat-card.accent-gold { --card-accent: #F59E0B; }
.auto-stat-card.accent-red { --card-accent: #EF4444; }
.auto-stat-card.accent-purple { --card-accent: #8B5CF6; }

.stat-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: rgba(22, 119, 255, 0.08);
  color: var(--card-accent, #1677FF);
}

.auto-stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--auto-navy);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.auto-stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--auto-text-muted);
}

/* Legacy Alias Support */
.stat-card {
  padding: 1.25rem 1.5rem;
  border-radius: var(--auto-radius-md);
  background: #ffffff;
  border: 1px solid var(--auto-border);
  position: relative;
  overflow: hidden;
  box-shadow: var(--auto-shadow-sm);
  transition: all 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--auto-shadow-md);
}
.stat-card .stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--auto-navy);
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: 0.82rem;
  color: var(--auto-text-muted);
  font-weight: 600;
  margin-top: 0.25rem;
}

/* ==========================================================================
   CARDS & PANELS
   ========================================================================== */
.card-modern {
  background: #FFFFFF;
  border: 1px solid var(--auto-border);
  border-radius: var(--auto-radius-md);
  box-shadow: var(--auto-shadow-sm);
  transition: all 0.2s ease;
}

.card-modern:hover {
  box-shadow: var(--auto-shadow-md);
}

.card-modern-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--auto-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FAFCFF;
  border-top-left-radius: var(--auto-radius-md);
  border-top-right-radius: var(--auto-radius-md);
}

.card-modern-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--auto-navy);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================================================
   TABLES (AUTOMOTIVE WORKSHOP WORK-ORDERS)
   ========================================================================== */
.table-modern {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.table-modern thead th {
  background: #F8FAFC;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748B;
  border-top: none;
  border-bottom: 1px solid #E2E8F0;
  padding: 0.9rem 1.15rem;
  white-space: nowrap;
}

.table-modern tbody td {
  padding: 0.9rem 1.15rem;
  vertical-align: middle;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.88rem;
  color: #334155;
}

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

.table-modern tbody tr:hover {
  background-color: #F8FAFC;
}

/* Vehicle Plate Badge */
.vehicle-plate-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #FFFFFF;
  color: #0F172A;
  border: 2px solid #0F172A;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.vehicle-plate-badge::before {
  content: "PK";
  background: #0F172A;
  color: #FFF;
  font-size: 0.6rem;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  font-weight: 700;
}

/* Status Badges */
.badge-subtle-success {
  background: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.badge-subtle-warning {
  background: #FFFBEB;
  color: #D97706;
  border: 1px solid #FDE68A;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.badge-subtle-danger {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.badge-subtle-info {
  background: #F0F9FF;
  color: #0284C7;
  border: 1px solid #BAE6FD;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ==========================================================================
   FORM CONTROLS & INPUTS
   ========================================================================== */
.form-control, .form-select {
  border-radius: var(--auto-radius-sm);
  border: 1px solid #CBD5E1;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  color: var(--auto-text-main);
  background-color: #FFFFFF;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--auto-blue);
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.16);
  outline: none;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--auto-slate);
  margin-bottom: 0.35rem;
}

/* Buttons */
.btn-primary-custom {
  background: linear-gradient(135deg, #1677FF 0%, #00C8E8 100%);
  color: #FFFFFF !important;
  border: none;
  border-radius: var(--auto-radius-sm);
  padding: 0.6rem 1.25rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(22, 119, 255, 0.3);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.btn-primary-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(22, 119, 255, 0.45);
}

.btn-auto-dark {
  background: linear-gradient(135deg, #101827 0%, #1E293B 100%);
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--auto-radius-sm);
  padding: 0.6rem 1.25rem;
  font-weight: 700;
  transition: all 0.2s ease;
}

.btn-auto-dark:hover {
  background: #1E293B;
  color: #38BDF8 !important;
}

/* ==========================================================================
   MODALS & DIALOGS
   ========================================================================== */
.modal-content {
  border-radius: var(--auto-radius-md);
  border: none;
  box-shadow: var(--auto-shadow-lg);
  overflow: hidden;
}

.modal-header {
  background: #101827;
  color: #FFFFFF;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1rem 1.5rem;
}

.modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.modal-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
}

.modal-footer {
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  padding: 0.85rem 1.5rem;
}

/* ==========================================================================
   MOBILE & RESPONSIVE BEHAVIOR
   ========================================================================== */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -280px;
    z-index: 1050;
  }
  
  .app-sidebar.show {
    left: 0;
  }
  
  .app-topbar {
    padding: 0 1rem;
  }
  
  .content-body {
    padding: 1rem;
  }
}

/* Print Specific Rules */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .app-sidebar, .app-topbar, .btn-print, .no-print {
    display: none !important;
  }
  .content-body, .app-main, .app-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  .invoice-container {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    width: 100% !important;
  }
}
