/* ============================================================
   TechFix — Admin & Workshop Management Portal Stylesheet
   Design System: Deep Navy (#0B132B) + Electric Blue (#2563EB) + Bright Cyan (#38BDF8)
   Font: Inter (Google Fonts) | Icons: Font Awesome 6.4
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Brand Colors */
  --primary-color:       #2563EB;
  --primary-hover:       #1D4ED8;
  --primary-light:       #EFF6FF;
  --primary-gradient:    linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  --accent-color:        #38BDF8;
  --accent:              #2563EB; /* Universal alias */
  --accent-hover:        #1D4ED8;
  --accent-light:        rgba(37, 99, 235, 0.08);

  /* Backgrounds */
  --bg-light:            #F8FAFC;
  --bg-card:             #FFFFFF;
  --card-bg:             #FFFFFF; /* Universal alias */
  --bg-dark:             #0A0F1E;
  --bg-sidebar:          #0B132B;
  --bg-sidebar-active:   #172554;
  --table-header:        #F1F5F9; /* Universal alias */

  /* Borders */
  --border-color:        #E2E8F0;
  --border:              #E2E8F0; /* Universal alias */
  --border-dark:         rgba(255, 255, 255, 0.08);

  /* Text Colors */
  --text-primary:        #0F172A;
  --text:                #0F172A; /* Universal alias */
  --text-secondary:      #475569;
  --text-muted:          #64748B;
  --text-muted-dark:     #94A3B8;
  --text-light:          #F8FAFC;
  --white:               #FFFFFF;

  /* Status Colors */
  --blue:                #2563EB;
  --green:               #10B981;
  --emerald:             #059669;
  --orange:              #F59E0B;
  --amber:               #D97706;
  --purple:              #8B5CF6;
  --indigo:              #6366F1;
  --red:                 #EF4444;
  --cyan:                #06B6D4;

  /* Shadows & Radii */
  --shadow-xs:           0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm:           0 2px 6px rgba(15, 23, 42, 0.06);
  --card-shadow:         0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --card-shadow-hover:   0 10px 25px -3px rgba(37, 99, 235, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --shadow-blue:         0 4px 14px rgba(37, 99, 235, 0.28);

  --radius-xs:           6px;
  --radius-sm:           8px;
  --radius-md:           12px;
  --radius-lg:           16px;
  --radius-full:         9999px;

  /* Dimensions */
  --sidebar-width:       260px;
  --sidebar-collapsed-width: 78px;
  --header-height:       70px;
  --transition-speed:    0.22s;
}

/* ── Base Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Font Awesome Icon Protection ── */
.fa, .fas, .far, .fal, .fad, .fab,
.fa-solid, .fa-regular, .fa-brands,
i[class*="fa-"],
[class^="fa-"], [class*=" fa-"],
[class^="fa-"]::before, [class*=" fa-"]::before,
[class^="fa-"]::after, [class*=" fa-"]::after {
  font-family: "Font Awesome 6 Free", "FontAwesome" !important;
  font-style: normal;
  font-variant: normal;
  text-rendering: auto;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
}

.fab, .fa-brands, .fab::before, .fa-brands::before {
  font-family: "Font Awesome 6 Brands", "FontAwesome" !important;
}

body {
  background-color: var(--bg-light);
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-speed);
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* ============================================================
   DASHBOARD LAYOUT CONTAINER
   ============================================================ */
.dashboard-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-light);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--bg-sidebar);
  color: var(--white);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1), transform var(--transition-speed) ease;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

/* Logo Header in Sidebar */
.logo-container {
  height: var(--header-height);
  padding: 0 18px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 15, 30, 0.6);
}

.brand-logo-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-decoration: none;
  overflow: hidden;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  max-width: 190px;
  object-fit: contain;
  transition: opacity 0.2s;
}

.brand-logo-icon {
  display: none;
  height: 36px;
  width: 36px;
}

.sidebar.collapsed .brand-logo-img {
  display: none;
}

.sidebar.collapsed .brand-logo-icon {
  display: block;
  margin: 0 auto;
}

/* Nav Section Titles */
.nav-section-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #64748B;
  padding: 18px 20px 8px;
}

.sidebar.collapsed .nav-section-title {
  display: none;
}

.main-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px;
}

.main-nav::-webkit-scrollbar {
  width: 4px;
}
.main-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.main-nav ul {
  list-style: none;
}

.main-nav li {
  margin-bottom: 4px;
}

.main-nav a {
  color: #94A3B8;
  text-decoration: none;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.main-nav a i:first-child {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: #64748B;
  transition: color 0.2s;
  flex-shrink: 0;
}

.main-nav a:hover {
  color: var(--white);
  background-color: rgba(255, 255, 255, 0.08);
}

.main-nav a:hover i:first-child {
  color: var(--accent-color);
}

.main-nav li.active > a {
  color: var(--white);
  background: var(--primary-gradient);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.main-nav li.active > a i:first-child {
  color: var(--white);
}

.sidebar.collapsed .main-nav a span {
  display: none;
}

.sidebar.collapsed .submenu-arrow {
  display: none;
}

/* Submenu */
.has-submenu {
  position: relative;
}

.submenu-arrow {
  margin-left: auto;
  font-size: 11px;
  transition: transform 0.2s ease;
  color: #64748B;
}

.has-submenu.open > .menu-toggle .submenu-arrow {
  transform: rotate(90deg);
  color: var(--accent-color);
}

.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background-color: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  margin: 4px 0 6px 8px;
  padding-left: 6px;
}

.has-submenu.open > .submenu {
  max-height: 400px;
}

.submenu li a {
  padding: 8px 12px;
  font-size: 13px;
  color: #94A3B8;
  font-weight: 500;
}

.submenu li a:hover {
  color: #FFFFFF;
}

.submenu li.active a {
  color: var(--accent-color);
  font-weight: 700;
  background: rgba(37, 99, 235, 0.15);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 15, 30, 0.5);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.sidebar-user-info {
  overflow: hidden;
  flex: 1;
}

.sidebar-user-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-user-role {
  font-size: 11px;
  color: #94A3B8;
  font-weight: 500;
}

.sidebar.collapsed .sidebar-user-info {
  display: none;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #F87171;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  width: 100%;
  border: none;
  background: none;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

.sidebar.collapsed .logout-btn span {
  display: none;
}

/* ============================================================
   MAIN CONTENT & HEADER
   ============================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  background-color: var(--bg-light);
}

.main-content.expanded {
  margin-left: var(--sidebar-collapsed-width);
}

/* Top Header */
.header {
  height: var(--header-height);
  background-color: var(--white);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

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

.sidebar-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-light);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  background: #E2E8F0;
  color: var(--text-primary);
}

.header-title-wrap h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-date {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-light);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Standard Buttons */
.btn-primary {
  background: var(--primary-gradient);
  color: var(--white);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13.5px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: var(--shadow-blue);
  white-space: nowrap;
}
.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-secondary:hover {
  background: var(--bg-light);
  color: var(--text-primary);
  border-color: #CBD5E1;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ============================================================
   METRIC & STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  padding: 24px;
}

.stat-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
  transition: all var(--transition-speed) ease;
}

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

/* ============================================================
   DATA TABLES & CARD CONTAINERS
   ============================================================ */
.table-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 24px;
}

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

.data-table th {
  background-color: #F8FAFC;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

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

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

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* ============================================================
   FORMS & INPUT CONTROLS
   ============================================================ */
.form-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--card-shadow);
}

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

.form-field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-control, .admin-input, .admin-select, .admin-textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--white);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}

.form-control:focus, .admin-input:focus, .admin-select:focus, .admin-textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ============================================================
   MOBILE RESPONSIVENESS & DRAWER
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 30, 0.6);
  backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px !important;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0 !important;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 0 16px;
  }
  .header-subtitle {
    display: none;
  }
  .stats-grid {
    padding: 16px;
    grid-template-columns: 1fr;
  }
}

/* Print Stylesheet for Job Sheets & Invoices */
@media print {
  .sidebar, .header, .sidebar-toggle, .btn-primary, .btn-secondary, .sidebar-footer {
    display: none !important;
  }
  .main-content {
    margin: 0 !important;
    padding: 0 !important;
    background: #FFFFFF !important;
  }
  .table-card, .form-card {
    border: none !important;
    box-shadow: none !important;
  }
}
