/* public/css/globals.css — Design System Va'a Tracker */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@300;400;500;600&family=Space+Mono:wght@400;700&display=swap');

/* ============================================================
   TOKENS
   ============================================================ */
:root {
  /* Couleurs */
  --c-bg:        #070f1e;
  --c-surface:   #0d1f3c;
  --c-surface2:  #112248;
  --c-border:    rgba(255,255,255,0.09);
  --c-border2:   rgba(255,255,255,0.15);

  --c-ocean:     #0891b2;
  --c-lagoon:    #06b6d4;
  --c-lagoon2:   #22d3ee;
  --c-coral:     #f97316;
  --c-gold:      #f59e0b;
  --c-green:     #22c55e;
  --c-purple:    #a855f7;
  --c-red:       #ef4444;

  --c-text:      #f1f5f9;
  --c-text2:     #94a3b8;
  --c-text3:     #64748b;

  /* Formules */
  --c-rameur-v1: #06b6d4;
  --c-club:      #f97316;
  --c-federation:#a855f7;

  /* Typographie */
  --f-display: 'Playfair Display', serif;
  --f-body:    'DM Sans', sans-serif;
  --f-mono:    'Space Mono', monospace;

  /* Rayons */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-full:9999px;

  /* Ombres */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.5);

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--f-body);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--c-lagoon); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: .8; }
button { cursor: pointer; border: none; font-family: var(--f-body); }
input, select, textarea { font-family: var(--f-body); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.t-display { font-family: var(--f-display); font-weight: 900; }
.t-mono    { font-family: var(--f-mono); }
.t-muted   { color: var(--c-text2); }
.t-small   { font-size: 12px; letter-spacing: .5px; }
.t-label   { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--c-text2); font-weight: 600; }
.t-gradient {
  background: linear-gradient(135deg, var(--c-lagoon), #f1f5f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.flex      { display: flex; }
.flex-col  { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ============================================================
   GLASS CARD
   ============================================================ */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: border-color .25s var(--ease);
}
.card:hover { border-color: var(--c-border2); }
.card-sm { padding: 14px 16px; border-radius: var(--r-md); }
.card-glass {
  background: rgba(13,31,60,.75);
  backdrop-filter: blur(20px);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; letter-spacing: .3px;
  transition: all .25s var(--ease); white-space: nowrap;
  position: relative; overflow: hidden;
}
.btn::after {
  content:''; position:absolute; inset:0;
  background: rgba(255,255,255,0);
  transition: background .2s;
}
.btn:hover::after { background: rgba(255,255,255,.06); }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--c-ocean), var(--c-lagoon));
  color: #fff;
  box-shadow: 0 4px 16px rgba(6,182,212,.3);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(6,182,212,.45); transform: translateY(-1px); }

.btn-coral {
  background: linear-gradient(135deg, #ea580c, var(--c-coral));
  color: #fff;
  box-shadow: 0 4px 16px rgba(249,115,22,.3);
}
.btn-green {
  background: linear-gradient(135deg, #16a34a, var(--c-green));
  color: #fff;
  box-shadow: 0 4px 16px rgba(34,197,94,.3);
}
.btn-red { background: linear-gradient(135deg, #dc2626, var(--c-red)); color:#fff; }
.btn-ghost {
  background: transparent; color: var(--c-text2);
  border: 1px solid var(--c-border);
}
.btn-ghost:hover { border-color: var(--c-border2); color: var(--c-text); }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--r-sm); }
.btn-lg { padding: 15px 32px; font-size: 16px; border-radius: var(--r-lg); }
.btn-icon { padding: 9px; width: 38px; height: 38px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 11px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--c-lagoon); margin-bottom: 7px;
}
.form-input {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md); color: var(--c-text);
  font-size: 14px; transition: all .25s; outline: none;
}
.form-input:focus {
  border-color: var(--c-lagoon);
  background: rgba(6,182,212,.07);
  box-shadow: 0 0 0 3px rgba(6,182,212,.12);
}
.form-input::placeholder { color: var(--c-text3); }
.form-select {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md); color: var(--c-text);
  font-size: 14px; outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.form-select option { background: var(--c-surface2); }
.form-select:focus { border-color: var(--c-lagoon); box-shadow: 0 0 0 3px rgba(6,182,212,.12); }
.form-textarea { resize: vertical; min-height: 90px; }
.form-error { font-size: 12px; color: var(--c-red); margin-top: 5px; }
.form-hint  { font-size: 11px; color: var(--c-text3); margin-top: 4px; }

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; letter-spacing: .5px;
}
.badge-green  { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.25); }
.badge-red    { background: rgba(239,68,68,.15);  color: #f87171; border: 1px solid rgba(239,68,68,.25); }
.badge-yellow { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.25); }
.badge-blue   { background: rgba(6,182,212,.15);  color: #22d3ee; border: 1px solid rgba(6,182,212,.25); }
.badge-orange { background: rgba(249,115,22,.15); color: #fb923c; border: 1px solid rgba(249,115,22,.25); }
.badge-purple { background: rgba(168,85,247,.15); color: #c084fc; border: 1px solid rgba(168,85,247,.25); }
.badge-live   { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.3); animation: pulse-badge 2s infinite; }
@keyframes pulse-badge { 0%,100%{opacity:1} 50%{opacity:.6} }

/* ============================================================
   STAT BOX
   ============================================================ */
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 20px;
  text-align: center;
}
.stat-value { font-family: var(--f-mono); font-size: 28px; font-weight: 700; color: var(--c-text); line-height: 1; }
.stat-label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--c-text2); margin-top: 6px; }
.stat-unit  { font-size: 13px; color: var(--c-text2); }
.stat-accent { color: var(--c-lagoon); }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--c-border); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--c-surface2); }
th {
  padding: 11px 16px; text-align: left;
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--c-text2); font-weight: 600; white-space: nowrap;
}
td { padding: 13px 16px; font-size: 13px; border-top: 1px solid var(--c-border); }
tr:hover td { background: rgba(255,255,255,.02); }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
  color: white;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-coral); position: absolute; top: -2px; right: -2px;
}
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px; z-index: 9999;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--r-md);
  background: var(--c-surface2);
  border: 1px solid var(--c-border2);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  font-size: 13px; min-width: 280px; max-width: 380px;
  animation: toast-in .3s var(--ease);
}
@keyframes toast-in { from{ opacity:0; transform:translateX(20px) } to{ opacity:1; transform:translateX(0) } }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-success { border-color: rgba(34,197,94,.3); }
.toast-error   { border-color: rgba(239,68,68,.3); }
.toast-info    { border-color: rgba(6,182,212,.3); }
.toast-warning { border-color: rgba(245,158,11,.3); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
  animation: fade-in .2s var(--ease);
}
@keyframes fade-in { from{opacity:0} to{opacity:1} }
.modal {
  background: var(--c-surface);
  border: 1px solid var(--c-border2);
  border-radius: var(--r-xl);
  padding: 32px;
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: modal-in .3s var(--ease);
}
@keyframes modal-in { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title  { font-family: var(--f-display); font-size: 20px; font-weight: 700; }
.modal-close  { width: 32px; height: 32px; border-radius: var(--r-sm); background: rgba(255,255,255,.07); color: var(--c-text2); font-size: 18px; display: flex; align-items:center; justify-content:center; transition: all .2s; }
.modal-close:hover { background: rgba(255,255,255,.12); color: var(--c-text); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress { height: 4px; background: rgba(255,255,255,.1); border-radius: var(--r-full); overflow: hidden; }
.progress-fill { height: 100%; border-radius: var(--r-full); transition: width .8s var(--ease); }

/* ============================================================
   CHRONO
   ============================================================ */
.chrono-display {
  font-family: var(--f-mono);
  font-size: 48px; font-weight: 700;
  color: var(--c-text); letter-spacing: 4px;
  text-shadow: 0 0 30px rgba(6,182,212,.4);
}
.chrono-display.running { color: var(--c-lagoon); }
.chrono-display.paused  { color: var(--c-gold); }

/* ============================================================
   SIDEBAR LAYOUT
   ============================================================ */
.app-layout {
  display: flex; height: 100vh; overflow: hidden;
}
.sidebar {
  width: 260px; flex-shrink: 0;
  background: linear-gradient(180deg, rgba(7,15,30,.99) 0%, rgba(13,31,60,.97) 100%);
  border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  transition: transform .35s var(--ease);
  z-index: 100;
}
.sidebar-logo {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--c-ocean), var(--c-lagoon));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.sidebar-logo-text { font-family: var(--f-display); font-size: 16px; font-weight: 700; }
.sidebar-logo-sub  { font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--c-text2); }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section { margin-bottom: 4px; }
.nav-label { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--c-text3); padding: 8px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 500; color: var(--c-text2);
  transition: all .2s var(--ease); cursor: pointer;
  position: relative;
}
.nav-item:hover  { background: rgba(255,255,255,.05); color: var(--c-text); }
.nav-item.active { background: rgba(6,182,212,.12); color: var(--c-lagoon); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; background: var(--c-lagoon); border-radius: 0 3px 3px 0;
}
.nav-icon  { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--c-coral); color:#fff; border-radius: var(--r-full); font-size:10px; font-weight:700; padding:1px 6px; min-width:18px; text-align:center; }
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--c-border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px; cursor: pointer;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: var(--c-text2); letter-spacing: .5px; }

.main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.page-header { padding: 28px 32px 0; }
.page-title  { font-family: var(--f-display); font-size: 26px; font-weight: 700; }
.page-sub    { font-size: 13px; color: var(--c-text2); margin-top: 4px; }
.page-body   { padding: 24px 32px 40px; flex: 1; }

/* ============================================================
   LOADER
   ============================================================ */
.loader { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--c-lagoon); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: flex; align-items: center; justify-content: center; height: 100vh; flex-direction: column; gap: 16px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { width: 100%; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-header, .page-body { padding-left: 16px; padding-right: 16px; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden   { display: none !important; }
.visible  { display: block !important; }
.flex-vis { display: flex !important; }
.w-full   { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.p-0  { padding: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--c-border); margin: 16px 0; }
.pill { display: inline-block; padding: 2px 10px; border-radius: var(--r-full); font-size: 11px; font-weight: 600; }
