@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --bg: #0d0d1f;
  --card: #1a1a2e;
  --text: #e0e0ff;
  --accent: #00ffff;
  --green: #00ff9d;
  --red: #ff3366;
  --purple: #b700ff;
  --gold: #ffd700;
  --blue: #0088ff;
  --orange: #ff6b00;
  --border: rgba(0, 255, 255, 0.3);
  --gradient-bg: linear-gradient(135deg, #0d0d1f, #1a1a3a, #0d0d1f);
  --glow: 0 0 20px rgba(0, 255, 255, 0.4);
}

body.dark-mode {
  --bg: #0d0d1f;
  --card: #1a1a2e;
  --text: #e0e0ff;
}

* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(0, 255, 255, 0.1) 0%, transparent 30%),
    radial-gradient(circle at 90% 80%, rgba(183, 0, 255, 0.1) 0%, transparent 30%);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  animation: none;
}

@keyframes bg-pulse {
  0% { background-color: #0d0d1f; }
  100% { background-color: #121230; }
}

/* Header fixe + menu compact */
header {
  background: linear-gradient(90deg, #16213e, #0f3460);
  padding: 1rem 2rem;
  border-bottom: 2px solid var(--accent);
  box-shadow: var(--glow);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2rem;
  background: linear-gradient(90deg, #00ffff, #b700ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
  animation: none;
}

@keyframes text-glow {
  0% { text-shadow: 0 0 10px rgba(0, 255, 255, 0.4); }
  100% { text-shadow: 0 0 25px rgba(0, 255, 255, 0.8); }
}

nav ul {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  list-style: none;
}

nav a {
  color: #aaa;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

nav a:hover, nav a.active {
  color: var(--accent);
  background: rgba(0, 255, 255, 0.15);
  text-shadow: 0 0 12px var(--accent);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

.user-info {
  font-size: 0.95rem;
  color: #ccc;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.user-info a {
  color: #ff6b6b;
  font-weight: 600;
  cursor: pointer;
}

.user-info a:hover { 
  color: #ff8fa3; 
}

/* Indicateur WebSocket */
.live-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 255, 255, 0.14);
}

#ws-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  transition: background 0.3s, box-shadow 0.3s;
  flex: 0 0 12px;
}

#ws-label {
  font-size: 0.86rem;
  color: #d7f7ff;
  line-height: 1;
  white-space: nowrap;
}

#ws-indicator.connected {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

#ws-indicator.warning {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
}

#ws-indicator.error {
  background: var(--red);
  box-shadow: 0 0 12px rgba(255, 51, 102, 0.8);
}

/* Dark mode toggle */
#dark-mode-toggle {
  cursor: pointer;
  font-size: 1.2rem;
}

/* Conteneur principal */
.container {
  max-width: 1300px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.card-heading-reset {
  margin: 0 !important;
}

.text-subtle {
  color: #cfefff;
  line-height: 1.5;
}

.muted-accent {
  color: #00ffff;
  font-style: italic;
}

.mt-sm {
  margin-top: 0.7rem;
}

.mt-md {
  margin-top: 0.9rem;
}

.mb-sm {
  margin-bottom: 0.8rem;
}

.mb-md {
  margin-bottom: 1rem;
}

.inline-block {
  display: inline-block;
}

.w-100 {
  width: 100%;
}

.footer-links {
  font-size: 0.9rem;
  margin-top: 1rem;
}

.footer-risk {
  font-size: 0.85rem;
  margin-top: 1rem;
  color: #ff3366;
}

.footer-link {
  color: var(--accent);
}

.global-loading {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 9999;
  flex-direction: column;
}

.global-loading.compact {
  background: rgba(0, 0, 0, 0.4);
}

.loading-spinner {
  background: #00ffff;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.loading-text {
  color: #fff;
  margin-top: 20px;
  font-size: 1.2rem;
}

/* Cartes */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 1.6rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: var(--gradient-bg);
}

.card:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34); 
}

.card h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem;
  text-align: left;
  margin-bottom: 1rem;
  color: var(--accent);
  text-shadow: none;
}

/* Boutons */
.btn {
  padding: 0.9rem 1.8rem;
  border: none;
  border-radius: 12px;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-success  { background: linear-gradient(45deg, #00ff9d, #00d0ff); color: black; }
.btn-danger   { background: linear-gradient(45deg, #ff3366, #ff6b6b); color: white; }
.btn-primary  { background: linear-gradient(45deg, #0088ff, #00ffff); color: white; }
.btn-warning  { background: linear-gradient(45deg, #ff6b00, #ffd700); color: black; }

.btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 0 30px currentColor;
}

/* Bouton copy */
.copy-btn {
  margin-left: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  background: var(--blue);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  color: white;
  font-weight: bold;
  z-index: 9999;
  transform: translateX(400px);
  transition: transform 0.4s ease;
  display: none;
}

.toast.success { background: #00ff9d; color: black; }
.toast.error { background: #ff3366; }

/* Grid */
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.cash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.value { 
  font-size: 1.8rem; 
  font-weight: bold; 
  color: var(--green); 
  animation: none; 
}

@keyframes value-pulse {
  0% { text-shadow: 0 0 5px var(--green); }
  50% { text-shadow: 0 0 15px var(--green); }
  100% { text-shadow: 0 0 5px var(--green); }
}

/* Chart */
.chart-container {
  position: relative;
  height: 400px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid var(--border);
  margin-top: 1rem;
  box-shadow: var(--glow);
}

/* Period selector for charts */
.chart-period-selector {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.period-btn {
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(0, 255, 255, 0.06);
  color: #9fdfff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.period-btn:hover {
  background: rgba(0, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(0, 255, 255, 0.6);
}
.period-btn.active {
  background: linear-gradient(135deg, rgba(0,255,255,0.25), rgba(0,136,255,0.25));
  color: #00ffff;
  border-color: #00ffff;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

/* Highlight pour les mises à jour live (dashboard.js) */
.updated-highlight {
  background-color: rgba(0, 255, 157, 0.15) !important;
  transition: background-color 0.6s ease;
  border-radius: 6px;
  padding: 2px 6px;
}

/* Tableaux */
table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 14px;
  overflow: hidden;
  margin-top: 1rem;
}

th {
  background: rgba(0, 255, 255, 0.15);
  padding: 1rem;
  text-align: center;
  color: var(--accent);
  font-weight: bold;
  text-transform: uppercase;
}

td { 
  padding: 0.9rem; 
  text-align: center; 
}

table tr {
  transition: opacity 0.4s ease, background-color 0.3s ease;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  background: #0f172a;
  color: #778da9;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
  height: 1.2em;
  margin: 0.5rem 0;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-table td { height: 2rem; }
.skeleton-chart { height: 400px; }

/* Badge mode */
#modeBadge {
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  margin-left: 1rem;
}

#modeBadge.simulation { 
  background: var(--orange); 
  color: black; 
}

/* Media queries responsive */
@media (max-width: 768px) {
  .header-content { text-align: left; }
  nav {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  nav ul {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.45rem;
    min-width: max-content;
    padding-bottom: 0.25rem;
  }
  nav a {
    white-space: nowrap;
    padding: 0.45rem 0.8rem;
  }
  .button-group { flex-direction: column; }
  .cash-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.8rem; }
  .card { padding: 1rem; }
  .chart-container { height: 300px; }
  table { font-size: 0.9rem; }
  th, td { padding: 0.5rem; }
  .container { padding: 0 1rem; }
  .container-wide { max-width: 100%; }
}

@media (max-width: 480px) {
  h2 { font-size: 1.5rem; }
  .btn { padding: 0.7rem 1.2rem; font-size: 0.9rem; }
  .user-info { flex-direction: row; flex-wrap: wrap; gap: 0.3rem; align-items: center; justify-content: center; }
  #username, .logout-link { margin-right: 0.3rem; }
}

/* Canvas Chart.js : transition douce */
canvas {
  transition: all 0.3s ease;
}

/* Global loading fade */
#global-loading {
  transition: opacity 0.3s ease;
}

/* ====================== LOGS DESIGN 2025 ====================== */
.logs-container {
  max-height: 70vh;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 14px;
  padding: 1rem;
  border: 1px solid var(--border);
  margin-top: 1rem;
  box-shadow: var(--glow);
}

.logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.log-entry {
  display: flex;
  flex-direction: column;
  background: rgba(20, 20, 40, 0.6);
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.4s ease forwards;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.1);
}

.log-entry:hover {
  background: rgba(30, 30, 60, 0.8);
  transform: translateX(5px);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.log-timestamp {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-family: 'Orbitron', sans-serif;
}

.log-message {
  font-size: 0.95rem;
  color: var(--text);
  word-break: break-word;
}

/* Niveaux de log */
.log-entry[data-level="INFO"]    { border-left-color: var(--green); }
.log-entry[data-level="WARNING"] { border-left-color: #ffaa00; }
.log-entry[data-level="ERROR"]   { border-left-color: var(--red); background: rgba(50, 10, 20, 0.4); }
.log-entry[data-level="DEBUG"]   { border-left-color: var(--purple); opacity: 0.8; }

/* Animation apparition */
@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.logs-footer {
  text-align: center;
  margin-top: 1rem;
  color: #888;
  font-size: 0.9rem;
}

/* Scrollbar personnalisée */
.logs-container::-webkit-scrollbar {
  width: 8px;
}
.logs-container::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
}
.logs-container::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 10px;
}
.logs-container::-webkit-scrollbar-thumb:hover {
  background: #00ffff;
}

/* ====================== PANNEAU ACTIVITÉ DASHBOARD ====================== */
.activity-card {
  margin-top: 2rem;
  background: linear-gradient(135deg, rgba(10,20,40,0.78), rgba(20,10,40,0.58));
  border: 1px solid rgba(0, 255, 255, 0.24);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.activity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.activity-item .label {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.activity-item .value.timer {
  font-size: 1.6rem;
  color: var(--green);
  font-weight: bold;
}

.quote {
  font-size: 1.1rem;
  font-style: italic;
  color: #a0f0ff;
  text-align: center;
  min-height: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 1s ease;
}

.quote.visible { 
  opacity: 1; 
}

/* Mini logs */
.mini-logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
}

.mini-logs-list .mini-log-entry {
  background: rgba(20, 30, 50, 0.6);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(8px);
  animation: fadeInUp 0.5s ease forwards;
}

.mini-log-entry .mini-log-timestamp {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.mini-log-entry .mini-log-message {
  color: var(--text);
  margin-top: 0.2rem;
  display: block;
}

.mini-log-decision { color: var(--gold); font-weight: bold; }
.mini-log-buy      { color: var(--green); font-weight: bold; }
.mini-log-sell     { color: var(--red); font-weight: bold; }

/* Mini-Jeu Design */
.mini-game {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  border: 1px solid var(--border);
  text-align: center;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#gameStatus {
  font-size: 1.1rem;
  color: var(--text);
  min-height: 2em;
}

.game-buttons {
  display: flex;
  gap: 1rem;
}

/* Ajouts dashboard pro 2025 */
.btn:hover:not(:disabled) { 
  transform: scale(1.05); 
}

.chart-container canvas { 
  cursor: pointer; 
}

.logs-container { 
  max-height: 400px; 
}

.mini-game button:hover { 
  box-shadow: 0 0 20px rgba(0,255,255,0.5); 
}

/* Paires actives badges */
.pair-badge {
  display: inline-block;
  background: rgba(0, 255, 255, 0.2);
  color: var(--accent);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  margin: 0.4rem;
  font-size: 0.9rem;
  border: 1px solid var(--accent);
  box-shadow: 0 6px 14px rgba(0, 255, 255, 0.16);
  animation: none;
}

@keyframes badge-pulse {
  0% { box-shadow: 0 0 10px rgba(0, 255, 255, 0.3); }
  100% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.6); }
}

#activePairsList {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.no-pairs-message {
  text-align: center;
  color: #888;
  font-style: italic;
  margin: 1rem 0;
  }

/* Clean UI pass: better reading rhythm, less visual fatigue */
.label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9fdfff;
  margin-bottom: 0.35rem;
}

.chart-container {
  border-radius: 12px;
  box-shadow: none;
}

.footer,
footer {
  padding: 1.5rem;
}
