/* ===========================
   Star Citizen Fleet — UI Kit
   =========================== */

/* --------- Thème (variables) --------- */
/* --------- Thème (variables) --------- */
/* Palette Prometheus (depuis le logo) */
:root{
  /* Base nuit / cartes */
  --bg:#0d1b2a;            /* bleu nuit */
  --card:#122232;          /* carte + sidebar */
  --text:#eaf2fc;          /* texte principal */
  --muted:#9fb3c7;         /* texte secondaire */
  --border:rgba(255,255,255,.12);

  /* Inputs */
  --input-bg:#0f2435;
  --input-text:#eaf2fc;
  --placeholder:#97a9ba;

  /* Actions & feedback */
  --btn-bg:#132739;
  --accent:#f5b037;        /* OR Phoenix */
  --accent-2:#c7a06b;      /* Bronze anneau */
  --accent-3:#3f5a4f;      /* Vert sauge cercle */
  --danger:#ff6b6b;
  --success:#41d695;

  --shadow:0 6px 20px rgba(0,0,0,.35);
}

/* Variante claire harmonisée */
[data-theme="light"]{
  --bg:#f7f9fc;
  --card:#ffffff;
  --text:#0f2334;
  --muted:#5d6e85;
  --border:rgba(0,0,0,.12);

  --input-bg:#eef3f8;
  --input-text:#0f2334;
  --placeholder:#8095a8;

  --btn-bg:#f5f7fa;
  --accent:#c78310;        /* or plus sobre en clair */
  --accent-2:#b18454;
  --accent-3:#4c6a5e;

  --danger:#d7263d;
  --success:#1aa36b;
  --shadow:0 8px 24px rgba(0,0,0,.08);
}


/* --------- Reset soft --------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji", "Segoe UI Symbol";
}

/* --------- Layout --------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

/* Header */
header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
}
header nav {
  display:flex; flex-wrap:wrap; gap:8px;
  align-items: center;
}

/* NAV: liens en boutons */
header nav a {
  display:inline-block;
  padding:8px 12px;
  border-radius:10px;
  text-decoration:none;
  border:1px solid var(--border);
  background:var(--btn-bg);
  color:var(--text);
  line-height:1.1;
  transition:transform .05s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
header nav a:hover { transform: translateY(-1px); }
header nav a.active{
  border-color: var(--accent);
color:var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

header nav a.active .ico path,
.nav a.active .ico path {
  fill: var(--accent);
}


/* --------- Cards / Sections --------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 10px; font-size: 18px; }

/* --------- Typo helpers --------- */
.muted { color: var(--muted); }
code { background: color-mix(in srgb, var(--card) 70%, black 30%); padding:2px 6px; border-radius:6px; border:1px solid var(--border); }

/* --------- Boutons --------- */
.btn {
  display:inline-flex; align-items:center; justify-content:center;
  padding:8px 12px; border-radius:10px;
  border:1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  cursor:pointer;
  text-decoration:none;
  transition: transform .05s ease, box-shadow .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity:.6; cursor:not-allowed; }
.btn.outline { background: transparent; }
.btn.primary {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}
.btn.danger { border-color: color-mix(in srgb, var(--danger) 60%, var(--border)); color:var(--danger); }

/* --------- Formulaires --------- */
label { display:block; margin: 6px 0 4px; color: var(--text); }
.input,
input.input,
select.input,
textarea.input {
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  width: 100%;
  outline: none;
}
textarea.input { min-height: 120px; resize: vertical; }

/* Selects lisibles en sombre */
select,
select.input {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: var(--input-bg) no-repeat right 12px center;
  color: var(--input-text);
}
select option {
  background: var(--card);
  color: var(--text);
}

/* Placeholders */
::placeholder { color: var(--placeholder); opacity: 1; }
::-ms-input-placeholder { color: var(--placeholder); }
:-ms-input-placeholder { color: var(--placeholder); }

/* Form layout helpers */
.rowform { display:grid; gap:10px; grid-template-columns: repeat(12, 1fr); }
.col-3{ grid-column: span 3; }
.col-4{ grid-column: span 4; }
.col-6{ grid-column: span 6; }
.col-12{ grid-column: span 12; }

/* --------- Tables --------- */
.table { width:100%; border-collapse: collapse; }
.table th, .table td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}
.table th { color: var(--muted); font-weight: 600; }

/* --------- Grilles / cartes vaisseaux --------- */
.grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap:12px; }
.ship { background: var(--card); border:1px solid var(--border); border-radius:12px; padding:10px; }
.ship img { width:100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display:block; }

/* --------- Details (éditeurs inline) --------- */
details summary {
  list-style: none;
}
details summary::-webkit-details-marker { display:none; }
details summary.btn { cursor: pointer; }

/* --------- Alerts (flash) --------- */
.alert { padding:10px 12px; border-radius:10px; border:1px solid var(--border); }
.alert.success { border-color: color-mix(in srgb, var(--success) 60%, var(--border)); color: var(--success); }
.alert.danger  { border-color: color-mix(in srgb, var(--danger) 60%, var(--border)); color: var(--danger); }

/* --------- Utilitaires --------- */
.hidden { display:none !important; }
.center { text-align:center; }
.right { text-align:right; }

/* --------- Responsive --------- */
@media (max-width: 720px) {
  .container { padding: 14px; }
  header { flex-direction: column; align-items: stretch; gap:10px; }
  .rowform { grid-template-columns: repeat(6, 1fr); }
  .col-6 { grid-column: span 6; }
  .col-4 { grid-column: span 6; }
  .col-3 { grid-column: span 6; }
}

/* --------- Toggle dark/light (si bouton JS ajoute un attr data-theme) --------- */
/* (rien à ajouter ici côté CSS, tout repose sur les variables au-dessus) */
/* --- Logo dans le header --- */
/* --- Logo dans le header (injecté par JS) --- */
header nav a.brand-logo{
  padding:0; border:none; background:transparent;
}
header nav a.brand-logo:hover{ transform:none; box-shadow:none; }
header nav a.brand-logo img{
  height:32px; width:auto; display:block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
  border-radius:8px;
  margin-right:6px;
}
@media (min-width: 900px){
  header nav a.brand-logo img{ height:52px; }
}

/* ==== Sidebar & layout (compléments) ==== */
.layout{display:grid; grid-template-columns: 250px 1fr; min-height:100vh;}
.sidebar{
  background: var(--card); border-right:1px solid var(--border);
  padding:12px; position:sticky; top:0; height:100vh;
  display:flex; flex-direction:column; gap:10px;
  transition: width .2s ease, padding .2s ease;
  width:250px;
}
.sidebar[data-collapsed="1"]{ width:74px; padding:12px 10px; }
.brand{display:flex; align-items:center; gap:10px; padding:6px 8px;}
.brand .logo{width:36px; height:36px; border-radius:8px; object-fit:contain; background:#1112;}
.brand .title{font-weight:700}
.collapse-btn{
  margin-left:auto; border:1px solid var(--border); background:var(--btn-bg);
  width:36px; height:36px; border-radius:10px; display:inline-flex; align-items:center; justify-content:center; cursor:pointer;
}
.nav{display:flex; flex-direction:column; gap:6px;}
.nav a{
  display:flex; align-items:center; gap:10px; padding:10px; border-radius:10px;
  text-decoration:none; color:var(--text); border:1px solid var(--border); background:var(--btn-bg);
}
.nav a.active{ border-color:var(--accent); box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent); }
.nav .ico{width:18px; height:18px; flex:0 0 18px;}
.nav .label{white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.sidebar[data-collapsed="1"] .label{display:none;}
.nav a[data-tip]{ position:relative; }
.sidebar[data-collapsed="1"] .nav a:hover::after{
  content: attr(data-tip); position:absolute; left: calc(100% + 8px); top:50%; transform:translateY(-50%);
  background:var(--bg); color:var(--text); border:1px solid var(--border); border-radius:8px; padding:6px 8px; white-space:nowrap; box-shadow: var(--shadow); z-index:20;
}
.spacer{flex:1}
.side-bottom{display:flex; flex-direction:column; gap:8px;}
.side-bottom .btn{justify-content:flex-start;}
.main{padding:18px; max-width:1400px; width:100%; margin:0 auto;}

.dash{display:grid; grid-template-columns: 2fr 1fr; gap:12px;}
@media (max-width: 1100px){ .layout{grid-template-columns: 74px 1fr;} .sidebar{width:74px; padding:12px 10px;} .dash{grid-template-columns:1fr;} }

/* Recherche: s’assure que l’icône ne chevauche pas le texte */
.search-wrap { position: relative; }
.search-wrap .search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%); width:16px; height:16px; pointer-events:none; opacity:.7; }
.search-wrap .input.search-input { padding-left:46px !important; box-sizing:border-box; }
/* --- Sidebar overflow fixes --- */
.sidebar { overflow: hidden; }
.brand .title {
  max-width: 120px;           /* ajuste si besoin */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav a { white-space: nowrap; }
.nav .label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Boutons/texte du bas : pas de retour à la ligne */
.side-bottom { align-items: stretch; }
.side-bottom .btn { width: 100%; white-space: nowrap; }
.side-bottom .muted {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* En mode “icônes” : on masque les textes qui pourraient déborder */
.sidebar[data-collapsed="1"] .side-bottom .muted,
.sidebar[data-collapsed="1"] .side-heading { display: none; }
/* --- Sidebar overflow & tooltips visible --- */
.sidebar{ overflow: visible; }               /* ← permet aux bulles de dépasser */
.sidebar .nav a[data-tip]{ position:relative; z-index: 1; }
.sidebar[data-collapsed="1"] .nav a:hover::after{ z-index: 20; }

/* --- Thème : icône en mode réduit, texte en mode normal --- */
.side-bottom .btn .theme-icon{ display:none; margin-right:0; }
.side-bottom .btn .theme-text{ display:inline; white-space:nowrap; }

/* --- Mode réduit: ne montrer que l’icône, PAS de font-size:0 sur le bouton --- */
.sidebar[data-collapsed="1"] .side-bottom .btn {
  padding: 10px;                 /* garde le bouton joli */
  font-size: inherit !important; /* <-- annule tout font-size:0 résiduel */
}
.sidebar[data-collapsed="1"] .side-bottom .btn .theme-icon {
  display: inline-block !important;
  font-size: 18px !important;    /* icône visible même si le parent avait font-size:0 */
  line-height: 1;
}
.sidebar[data-collapsed="1"] .side-bottom .btn .theme-text {
  display: none !important;      /* cache le texte, on ne garde que l’icône */
}


/* En mode "icônes" : montrer l'icône, cacher le texte */
.sidebar[data-collapsed="1"] .side-bottom .btn .theme-icon{ display:inline; }
.sidebar[data-collapsed="1"] .side-bottom .btn .theme-text{ display:none; }

/* (On garde la troncature douce des labels) */
.brand .title{ max-width:140px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.nav .label{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* --- Burger bien aligné même en mode réduit --- */
.brand{ position: relative; }                    /* important */
.collapse-btn{
  position: absolute;                            /* se place dans la .brand */
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

/* Optionnel : évite que le logo/titre pousse le burger */
.sidebar[data-collapsed="1"] .brand .title{ display:none; }

/* ===== Prometheus accents (or/bronze/sauge) ===== */

/* Boutons primaires bien visibles sur fond nuit */
.btn.primary{
  background: color-mix(in srgb, var(--accent) 88%, transparent);
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  color:#1a1206; /* lisible sur l’or */
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}
.btn.primary:hover{ transform: translateY(-1px) scale(1.01); }

header nav a.active,
.nav a.active{
  border-color: color-mix(in srgb, var(--accent) 65%, var(--border));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}

/* Focus visibles et cohérents */
.input:focus,
select.input:focus,
textarea.input:focus,
.btn:focus{
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* Petites pastilles */
.pill.role-admin{
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: #f1b74a;
  border:1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.pill.role-user{
  background: color-mix(in srgb, var(--accent-3) 15%, transparent);
  color: #9fd2bf;
  border:1px solid color-mix(in srgb, var(--accent-3) 40%, transparent);
}

/* Liens d’action (ex: “Fiche RSI”) */
a.btn.outline:hover{
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

/* Légère teinte des cartes */
.card{
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--card) 95%, var(--accent-3) 5%), var(--card));
}

/* Barres/curseurs de graphiques (si Chart.js prend la couleur actuelle) */
:root{
  --chart-accent: var(--accent);
  --chart-muted:  color-mix(in srgb, var(--accent-3) 60%, transparent);
}
