@import url('https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,700&family=Chakra+Petch:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #070707;
  --panel: #161414;
  --panel-card: #1c1818;
  --line: #332829;
  --line-strong: #4f1d22;
  --red: #ef0d19;
  --red2: #a90009;
  --red-glow: rgba(239, 13, 25, 0.35);
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.3);
  --text: #f0eeee;
  --muted: #9c9191;
  --sidebar-w: 244px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, .font-racing {
  font-family: 'Chakra Petch', 'Barlow', sans-serif;
  letter-spacing: 0.5px;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

/* App Shell Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar Desktop */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  inset: 0 auto 0 0;
  background: #050505;
  border-right: 1px solid #1f1b1c;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  z-index: 30;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.brand {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.brand img {
  max-width: 215px;
  max-height: 58px;
  object-fit: contain;
}

.fund, .primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: linear-gradient(105deg, #ff202c, #c9000a);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  font-family: 'Chakra Petch', sans-serif;
  letter-spacing: 1px;
  padding: 13px 16px;
  box-shadow: 0 0 22px rgba(224, 0, 24, 0.32);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
  text-align: center;
  text-decoration: none;
}

.fund:hover, .primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 0 28px rgba(224, 0, 24, 0.55);
}

.fund:active, .primary:active {
  transform: scale(0.98);
}

.sidebar nav {
  display: grid;
  gap: 5px;
  margin-top: 20px;
}

.nav-link {
  display: flex;
  gap: 12px;
  align-items: center;
  color: #aaa;
  text-decoration: none;
  padding: 11px 13px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.nav-link:hover {
  color: #fff;
  background: rgba(45, 8, 10, 0.6);
}

.nav-link.active {
  background: #2d080a;
  color: #fff;
  border-left: 3px solid var(--red);
  font-weight: 700;
}

.nav-link b {
  margin-left: auto;
  color: var(--red);
  font-size: 11px;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.side-bottom {
  margin-top: auto;
  border-top: 1px solid #1f1b1c;
  padding-top: 14px;
}

.user-chip {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #211a1b;
  border: 1px solid #3d2224;
  border-radius: 10px;
  padding: 10px;
}

.user-chip strong, .profile-head > strong {
  background: linear-gradient(135deg, var(--red), var(--red2));
  color: #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-family: 'Chakra Petch', sans-serif;
  font-weight: 700;
  flex: none;
}

.user-chip b, .user-chip small {
  display: block;
  font-size: 12px;
}

.user-chip small {
  color: var(--red);
  font-weight: 600;
}

.logout-btn {
  display: block;
  width: 100%;
  text-align: center;
  margin: 12px 0 0;
  background: none;
  border: 0;
  color: #b54a50;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s;
}

.logout-btn:hover {
  color: var(--red);
}

/* Main Container */
.main {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-width: 0;
}

header.cockpit-header {
  height: 78px;
  border-bottom: 1px solid #191616;
  background: #080707eb;
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

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

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

.header-actions .button-like, .header-actions button {
  background: #0d0c0c;
  border: 1px solid #2b2525;
  color: #ddd;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  transition: all 0.2s;
}

.header-actions .button-like:hover, .header-actions button:hover {
  color: #fff;
  border-color: var(--red);
  background: #1c0a0c;
  box-shadow: 0 0 16px rgba(239, 13, 25, 0.25);
}

.content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 28px 80px;
}

/* Page Titles */
.page-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 24px;
}

.title-icon {
  color: var(--red);
  border: 1px solid #581118;
  background: #23090b;
  border-radius: 14px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 24px;
  flex: none;
}

.page-title small {
  color: var(--red);
  letter-spacing: 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  display: block;
}

.page-title h1 {
  font-size: 30px;
  margin: 2px 0 0;
  color: #fff;
}

/* Hero Section */
.hero {
  border: 1px solid #6d151c;
  border-radius: 20px;
  overflow: hidden;
  padding: 50px 34px;
  position: relative;
  background: linear-gradient(90deg, #130304f5 0%, #0d0405dd 45%, #07070777 100%), 
              url('../images/cars/car-hero-D5astTPV.jpg') right center / cover no-repeat;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 0 80px rgba(239, 13, 25, 0.1);
  margin-bottom: 24px;
}

.hero small {
  color: var(--red);
  letter-spacing: 3px;
  font-weight: 700;
  text-transform: uppercase;
  display: block;
}

.hero h2 {
  font-size: 34px;
  margin: 8px 0;
  color: #fff;
}

.hero p {
  color: var(--muted);
  max-width: 460px;
  line-height: 1.5;
  margin: 8px 0 16px;
  font-size: 14px;
}

/* Stats Metric Grid */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.stat, .panel, .car-card {
  background: repeating-linear-gradient(135deg, #171415 0, #171415 3px, #141112 3px, #141112 6px);
  border: 1px solid #382c2d;
  border-radius: 16px;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s, box-shadow 0.25s;
}

.stat:hover, .panel:hover {
  border-color: #5d252a;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.stat {
  padding: 18px 16px;
  min-height: 108px;
}

.stat.red {
  border-color: #8c151c;
  box-shadow: 0 8px 25px rgba(239, 13, 25, 0.15);
}

.stat small {
  color: #9d9292;
  letter-spacing: 1.5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  display: block;
}

.stat strong {
  display: block;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 24px;
  margin-top: 10px;
  color: #fff;
}

/* Quick Actions */
.quick {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 18px 0;
}

.quick a, .quick button {
  background: #171314;
  border: 1px solid #2e2425;
  color: #fff;
  border-radius: 14px;
  padding: 14px 8px;
  display: grid;
  gap: 8px;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.quick a:hover, .quick button:hover {
  transform: translateY(-2px);
  border-color: var(--red);
  background: #230b0d;
  box-shadow: 0 0 18px rgba(239, 13, 25, 0.25);
}

.quick .nav-icon {
  font-size: 22px;
}

/* Two Columns Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.panel {
  padding: 22px;
  margin-bottom: 16px;
}

.panel h3 {
  color: #eee;
  margin: 0 0 16px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.empty {
  text-align: center;
  color: #817878;
  padding: 34px 20px;
  font-size: 14px;
  line-height: 1.6;
}

.movement {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #282122;
  color: #c5bebe;
  font-size: 13px;
}

.movement:last-child {
  border-bottom: 0;
}

.movement b {
  color: #fff;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 14px;
}

/* Car Cards & Garage */
.car-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.car-card {
  overflow: hidden;
  border: 1px solid #362a2b;
  position: relative;
}

.car-card:hover {
  transform: translateY(-5px);
  border-color: #b9141e;
  box-shadow: 0 0 0 1px #b9141e, 0 14px 34px rgba(176, 0, 23, 0.35);
}

.car-image {
  height: 195px;
  position: relative;
  background: #0e0d0d;
  overflow: hidden;
}

.car-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), filter 0.35s;
}

.car-card:hover .car-image img {
  transform: scale(1.06);
  filter: brightness(1.08);
}

.car-image span, .car-image em {
  position: absolute;
  top: 12px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.5px;
  z-index: 2;
}

.car-image span {
  left: 12px;
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 12px rgba(239, 13, 25, 0.4);
}

.car-image em {
  right: 12px;
  background: #0c331c;
  color: #4ade80;
  border: 1px solid #165b32;
}

.car-body {
  padding: 16px;
}

.car-body h2 {
  font-size: 20px;
  margin: 0 0 6px;
  color: #fff;
}

.car-body p {
  font-size: 12px;
  color: var(--muted);
  min-height: 34px;
  line-height: 1.45;
  margin: 0;
}

.car-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.car-meta span {
  background: #201a1b;
  border: 1px solid #332728;
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  font-size: 9px;
  color: #999;
  text-transform: uppercase;
}

.car-meta strong {
  display: block;
  color: #fff;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 13px;
  margin-top: 4px;
}

.car-body > small {
  color: #999;
  font-size: 11px;
  display: block;
  margin-bottom: 12px;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.actions > * {
  flex: 1;
}

.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #110e0e;
  border: 1px solid #332829;
  border-radius: 9px;
  color: #eee;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}

.button-like:hover {
  background: #1f1415;
  border-color: #5c2024;
  color: #fff;
}

.button-like.primary {
  background: linear-gradient(105deg, var(--red), var(--red2));
  border-color: transparent;
  color: #fff;
  font-weight: 700;
}

/* Tabs */
.tabs {
  display: flex;
  background: #1e191a;
  border: 1px solid #342627;
  border-radius: 12px;
  padding: 4px;
  margin: 16px 0;
  gap: 4px;
}

.tabs button, .tabs a {
  background: none;
  border: 0;
  color: #a69e9e;
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s;
}

.tabs .selected, .tabs button:hover, .tabs a.selected {
  background: #080808;
  color: #fff;
  border: 1px solid #4a2024;
}

/* Forms & Inputs */
.form-panel {
  max-width: 680px;
  margin: auto;
}

.form-panel input, .profile input, .invite input, select.custom-select {
  display: block;
  width: 100%;
  margin: 10px 0 16px;
  padding: 13px 14px;
  background: #120f10;
  color: #eee;
  border: 1px solid #3d2d2f;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-panel input:focus, .profile input:focus, select.custom-select:focus {
  border-color: var(--red);
  box-shadow: 0 0 14px rgba(239, 13, 25, 0.25);
}

.form-panel label, .profile label {
  font-size: 11px;
  font-weight: 700;
  color: #ccc;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hint {
  font-size: 12px;
  color: #928787;
  line-height: 1.5;
  margin: -6px 0 14px;
}

.suggestions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 0 18px;
}

.suggestions button {
  background: #130f10;
  border: 1px solid #332627;
  color: #ddd;
  padding: 11px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.suggestions button.selected, .suggestions button:hover {
  background: #2b080b;
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 0 14px rgba(239, 13, 25, 0.3);
}

.withdraw-limits {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.withdraw-limits div {
  background: #1c1516;
  border: 1px solid #38282a;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.withdraw-limits small {
  color: #928686;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  display: block;
}

.withdraw-limits strong {
  margin-top: 6px;
  display: block;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 17px;
  color: #fff;
}

/* Status Notifications */
.status-box {
  border: 1px solid #4a282b;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 14px 0;
  color: #eee;
  background: #1c1112;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: drive-in 0.3s ease both;
}

.status-box.success {
  border-color: #1b6338;
  background: #0d2817;
  color: #86efac;
}

.status-box.error {
  border-color: #8c151c;
  background: #26090c;
  color: #fca5a5;
}

@keyframes drive-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Network & Referral Tree */
.network-levels {
  display: grid;
  gap: 10px;
}

.network-level {
  display: grid;
  grid-template-columns: 60px repeat(3, 1fr);
  align-items: center;
  border: 1px solid #332627;
  background: #161213;
  border-radius: 12px;
  padding: 14px;
  gap: 10px;
}

.network-level > b {
  color: var(--red);
  font-family: 'Chakra Petch', sans-serif;
  font-size: 20px;
}

.network-level span {
  color: #908484;
  font-size: 10px;
  text-transform: uppercase;
}

.network-level strong {
  display: block;
  color: #fff;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 15px;
  margin-top: 4px;
}

.invite-box {
  background: #191213;
  border: 1px solid #4d1e23;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.invite-input-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.invite-input-row input {
  margin: 0;
  text-align: center;
  font-weight: 700;
  letter-spacing: 1px;
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
}

.mobile-menu-toggle {
  display: none;
  background: #110e0e;
  border: 1px solid #2f2425;
  color: #eee;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 20px;
}

/* Responsiveness */
@media (max-width: 850px) {
  .sidebar {
    width: 280px;
    transform: translateX(-110%);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.9);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
    width: 100%;
  }
  .mobile-menu-toggle {
    display: grid;
    place-items: center;
  }
  .content {
    padding: 18px 16px 90px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .car-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .quick {
    grid-template-columns: repeat(3, 1fr);
  }
  .mobile-bottom-nav {
    position: fixed;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    left: 0;
    right: 0;
    bottom: 0;
    height: 68px;
    background: #080606f5;
    border-top: 1px solid #332325;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.8);
    z-index: 45;
    backdrop-filter: blur(10px);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-nav-link {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    color: #9f9192;
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
  }
  .mobile-nav-link.active {
    color: var(--red);
  }
  .mobile-nav-link .nav-icon {
    font-size: 20px;
  }
}

@media (max-width: 580px) {
  .stats, .car-grid {
    grid-template-columns: 1fr;
  }
  .suggestions {
    grid-template-columns: repeat(2, 1fr);
  }
  .quick {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero h2 {
    font-size: 27px;
  }
  .page-title h1 {
    font-size: 24px;
  }
  .withdraw-limits {
    grid-template-columns: 1fr;
  }
  .network-level {
    grid-template-columns: 45px 1fr 1fr;
  }
  .network-level span:last-child {
    grid-column: 2 / -1;
  }
}
