/* ============================================
   GPH Dashboard - style.css
   ============================================ */

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

:root {
  --clr-primary: #2563eb;
  --clr-primary-dark: #1d4ed8;
  --clr-primary-light: #dbeafe;
  --clr-accent: #0ea5e9;
  --clr-bg: #f1f5f9;
  --clr-surface: #ffffff;
  --clr-text: #1e293b;
  --clr-text-muted: #64748b;
  --clr-border: #e2e8f0;
  --clr-success: #16a34a;
  --clr-warning: #f59e0b;
  --clr-danger: #dc2626;
  --sidebar-w: 260px;
  --navbar-h: 64px;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.07);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.1);
  --transition: .25s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  padding: 1rem;
}

.login-card {
  background: var(--clr-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}

.login-card .logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .logo h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--clr-primary);
}

.login-card .logo p {
  color: var(--clr-text-muted);
  font-size: .9rem;
  margin-top: .25rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .4rem;
  color: var(--clr-text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .7rem 1rem;
  border: 1.5px solid var(--clr-border);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--clr-text);
  background: var(--clr-surface);
  transition: border var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-light);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--clr-primary);
  color: #fff;
}

.btn-primary:hover { background: var(--clr-primary-dark); }

.btn-block { width: 100%; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--clr-border);
  color: var(--clr-text);
}

.btn-outline:hover { background: var(--clr-bg); }

.btn-success { background: var(--clr-success); color: #fff; }
.btn-success:hover { background: #15803d; }

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

/* ============================================
   LAYOUT – Sidebar + Navbar + Main
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.sidebar-brand span {
  font-size: .75rem;
  color: #94a3b8;
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-section-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #475569;
  padding: .75rem 1.5rem .35rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.5rem;
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
}

.sidebar-nav a.active {
  background: rgba(37,99,235,.15);
  color: var(--clr-accent);
  border-left-color: var(--clr-accent);
}

.sidebar-nav a .icon {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
  color: #475569;
}

/* --- Main wrapper --- */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Top Navbar --- */
.topnav {
  position: sticky;
  top: 0;
  height: var(--navbar-h);
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topnav-left .page-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--clr-text);
  padding: .25rem;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topnav-right .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--clr-primary-light);
  color: var(--clr-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
}

.topnav-right .user-name {
  font-size: .9rem;
  font-weight: 600;
}

/* --- Page Content --- */
.page-content {
  flex: 1;
  padding: 2rem;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--clr-surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--clr-border);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: .75rem;
}

.stat-card .stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-card .stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-card .stat-icon.amber  { background: #fef3c7; color: #d97706; }
.stat-card .stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-card h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card p {
  color: var(--clr-text-muted);
  font-size: .85rem;
  margin-top: .15rem;
}

/* ============================================
   TABLE
   ============================================ */
.card {
  background: var(--clr-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--clr-border);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-body { padding: 1.5rem; }
.card-body.no-pad { padding: 0; }

.table-responsive { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

table thead th {
  text-align: left;
  padding: .85rem 1.25rem;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--clr-text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--clr-border);
}

table tbody td {
  padding: .85rem 1.25rem;
  font-size: .9rem;
  border-bottom: 1px solid var(--clr-border);
  color: var(--clr-text);
}

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

table tbody tr:hover { background: #f8fafc; }

.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-amber  { background: #fef3c7; color: #92400e; }

/* ============================================
   FORMS (Add Car, etc.)
   ============================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
}

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

.form-actions {
  display: flex;
  gap: .75rem;
  margin-top: .5rem;
}

/* ============================================
   CAR DETAIL
   ============================================ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
}

.detail-item label {
  display: block;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--clr-text-muted);
  margin-bottom: .2rem;
}

.detail-item span {
  font-size: 1rem;
  font-weight: 500;
}

/* ============================================
   PROFILE
   ============================================ */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--clr-primary-light);
  color: var(--clr-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-info h2 { font-size: 1.35rem; font-weight: 700; }
.profile-info p  { color: var(--clr-text-muted); font-size: .9rem; }

.info-row {
  display: flex;
  justify-content: space-between;
  padding: .85rem 0;
  border-bottom: 1px solid var(--clr-border);
  font-size: .95rem;
}

.info-row:last-child { border-bottom: none; }
.info-row .info-label { color: var(--clr-text-muted); }
.info-row .info-value { font-weight: 500; }

/* ============================================
   ADDED CAR CARD (preview after submit)
   ============================================ */
.car-preview-card {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.car-preview-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--clr-primary);
}

/* ============================================
   MOBILE OVERLAY
   ============================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay.open { display: block; }

  .main-wrapper { margin-left: 0; }

  .hamburger { display: block; }

  .topnav { padding: 0 1rem; }

  .page-content { padding: 1.25rem; }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .form-grid { grid-template-columns: 1fr; }

  .detail-grid { grid-template-columns: 1fr; }

  .profile-header { flex-direction: column; text-align: center; }
}

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

  .stat-card h1 { font-size: 1.6rem; }

  .login-card { padding: 2rem 1.25rem; }
}