@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Toyota modern dark */
  --bg: #07080C;
  --panel: rgba(255, 255, 255, .03);
  --panel2: rgba(255, 255, 255, .06);
  --line: rgba(255, 255, 255, .10);
  --text: rgba(255, 255, 255, .92);
  --muted: rgba(255, 255, 255, .55);

  /* Toyota red accents */
  --primary: #EB0A1E;
  --primary2: #FF3B47;
  --primaryGlow: rgba(235, 10, 30, .25);

  --success: #23d18b;
  --danger: #ff4d6d;
  --warn: #ffb020;

  --r: 16px;
  --ease: cubic-bezier(.2, .9, .2, 1);
  
  --sidebar-width: 260px;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; overflow: hidden; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* Subtle background layer */
.bg { position: fixed; inset: 0; pointer-events: none; z-index: -1; 
  background: radial-gradient(800px 600px at 15% 5%, rgba(235, 10, 30, .12) 0%, rgba(0, 0, 0, 0) 70%), linear-gradient(180deg, #0b0d14, var(--bg));
}
.gridNoise {
  position: absolute; inset: 0; opacity: .03;
  background-image: linear-gradient(rgba(255,255,255,.2) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.2) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ==================== LOGIN VIEW ==================== */
.login-shell { display: flex; align-items: center; justify-content: center; height: 100vh; width: 100vw; padding: 20px; }
.login { width: 100%; max-width: 400px; }
.brand-center { text-align: center; margin-bottom: 30px; }
.brand-center .mark { margin: 0 auto 15px auto; width: 60px; height: 60px; }

/* ==================== MAIN DASHBOARD LAYOUT ==================== */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(10, 12, 18, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--ease);
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
/* Default logo size (for the sidebar and top left) */
.mark {
  width: 160px;  /* Made it much wider */
  height: 60px;  /* Made it taller */
  background-image: url('Logoup.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center; /* Aligns it to the left so it looks good next to text */
  background-color: transparent;
  box-shadow: none;
  border-radius: 0;
}

/* Make it huge for the Login Screen */
.brand-center .mark {
  width: 280px;
  height: 120px;
  margin: 0 auto 15px auto;
  background-position: center; /* Centers it on the login screen */
}

.nav-links { list-style: none; padding: 20px 12px; margin: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 12px;
  color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px;
  transition: all 0.2s var(--ease); border: 1px solid transparent;
}
.nav-item svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.04); }
.nav-item.active {
  background: rgba(235,10,30,0.1); border-color: rgba(235,10,30,0.3);
  color: #fff; box-shadow: 0 4px 15px rgba(235,10,30,0.05);
}
.nav-item.active svg { stroke: var(--primary2); }

.sidebar-footer {
  padding: 20px 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.2);
}

/* MAIN CONTENT */
.main-content {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 30px; border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.3); backdrop-filter: blur(20px); z-index: 10;
}
.topbar h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }

.mobile-toggle { display: none; cursor: pointer; }
.mobile-toggle svg { width: 24px; height: 24px; stroke: #fff; stroke-width: 2; }

.scroll-area {
  flex: 1; overflow-y: auto; padding: 30px;
}

/* ==================== VIEWS & GRIDS ==================== */
.view { animation: fadeIn 0.3s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px; align-items: start;
}
.col-stack { display: flex; flex-direction: column; gap: 24px; }

.card {
  min-width: 0; border-radius: var(--r); border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  box-shadow: 0 15px 40px rgba(0, 0, 0, .35); padding: 24px;
}

/* ==================== COMPONENTS ==================== */
h3 { margin: 0; font-size: 16px; font-weight: 700; color: #fff; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.head, .head2 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

.fields { display: grid; gap: 14px; }
label { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;}

input, select {
  width: 100%; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, .4); color: var(--text); font-family: inherit; font-size: 14px; outline: none; transition: all .2s var(--ease);
}
input:focus, select:focus { border-color: rgba(235, 10, 30, .6); box-shadow: 0 0 0 3px var(--primaryGlow); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .btn, .row > label { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--text);
  padding: 12px 18px; border-radius: 12px; cursor: pointer; font-weight: 800; font-size: 13px;
  text-transform: uppercase; transition: all .15s var(--ease); white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); background: rgba(255, 255, 255, .08); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn.primary { border: none; background: linear-gradient(135deg, var(--primary), var(--primary2)); box-shadow: 0 8px 20px var(--primaryGlow); color: white; }
.btn.success { border-color: rgba(35, 209, 139, .5); background: rgba(35, 209, 139, .15); color: var(--success); }
.btn.danger { border-color: rgba(255, 77, 109, .5); background: rgba(255, 77, 109, .15); color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.icon-btn { padding: 10px; border-radius: 10px; } .icon-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.5; fill: none; }

.totalRow .btn, .item .btn { padding: 8px 12px; font-size: 11px; border-radius: 8px; }

/* Current Up */
.currentCard { border: 1px solid var(--line); background: rgba(0,0,0,0.4); border-radius: 14px; padding: 24px 16px; text-align: center; margin-bottom: 16px; }
.currentCard .big { font-weight: 900; font-size: 24px; color: #fff; margin-bottom: 6px; }
.currentCard .muted { color: var(--muted); font-size: 13px; }

.pill, .chip, .badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 50px; font-weight: 800; font-size: 11px; text-transform: uppercase; }
.pill { background: rgba(255,255,255,.1); padding: 6px 12px; color: #fff; }
.chip { border: 1px solid var(--line); background: rgba(255,255,255,.05); padding: 5px 10px; }
.badge { border: 1px solid var(--line); padding: 6px 12px; background: rgba(0,0,0,.4); }
.badge.next { border-color: var(--primary); background: var(--primaryGlow); color: #fff; box-shadow: 0 0 10px var(--primaryGlow); }

/* Lists */
.list, .totals { display: flex; flex-direction: column; gap: 10px; padding: 0; margin: 0; list-style: none; }
.item, .totalRow {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .03); border-radius: 14px; padding: 16px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; transition: all .2s var(--ease);
}
.item:hover, .totalRow:hover { background: rgba(255, 255, 255, .06); border-color: rgba(255,255,255,.15); }
.item > div[style], .totalRow > div[style] { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.name { font-weight: 700; font-size: 15px; color: #fff; }
.meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.count { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; background: var(--primaryGlow); border: 1px solid rgba(235,10,30,.5); color: #fff; box-shadow: 0 0 15px rgba(235,10,30,.2); }

.empty { margin-top: 10px; padding: 24px; border: 1px dashed var(--line); border-radius: 14px; text-align: center; color: var(--muted); font-size: 13px; font-style: italic; }
.hint { margin-top: 10px; color: var(--warn); font-size: 12px; text-align: center; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; text-align: center;}

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #fff; color: #000; font-weight: 700; border-radius: 50px; padding: 12px 24px; box-shadow: 0 10px 30px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: all .2s var(--ease); z-index: 9999; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==================== MODALS ==================== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s var(--ease);
}
.modal-content {
  width: 90%; max-width: 420px;
  animation: modalPop 0.3s var(--ease);
}
@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* MOBILE RESPONSIVE */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,0.8); }
  .mobile-toggle { display: block; margin-right: 15px; }
  .topbar { padding: 15px 20px; }
  .topbar h2 { flex: 1; font-size: 18px; }
  .scroll-area { padding: 20px 15px; }
  .grid { grid-template-columns: 1fr; }

}
/* Empêche le curseur de texte d'apparaître sur les éléments cliquables */
button, 
.nav-item, 
.card h3, 
.big, 
.chip,
.drag-handle,
.interactive-cell {
    user-select: none;
    -webkit-user-select: none; 
    -moz-user-select: none;    
    outline: none; /* Enlève aussi le contour de focus par défaut */
}

/* Force le curseur "main" (pointer) pour bien montrer que c'est cliquable */
button, .nav-item, .interactive-cell {
    cursor: pointer !important;
}
