/* ===========================
   KALEXEX — Global Styles
   Thème Oriental / Mystique
   =========================== */

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

:root {
  --bg-dark: #0a0a1a;
  --bg-card: #12122a;
  --bg-card-hover: #1a1a3a;
  --gold: #7db8f0;
  --gold-light: #a8d4ff;
  --purple: #6b2fa0;
  --purple-light: #9b5fd0;
  --bordeaux: #8b1a4a;
  --text: #e8e0d0;
  --text-muted: #8a8098;
  --text-dim: #5a5068;
  --accent: var(--gold);
  --danger: #e74c3c;
  --success: #2ecc71;
  --border: rgba(99, 130, 241, 0.15);
  --shadow: rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-sm: 8px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

h1, h2, h3, h4, h5 {
  font-family: 'Playfair Display', serif;
  color: var(--gold);
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: var(--gold-light);
}

/* ===========================
   BUTTONS
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(270deg, #1e3a8a, #4338ca, #1e3a8a);
  background-size: 200% 100%;
  animation: slideGradient 4s ease infinite;
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

@keyframes slideGradient { 0%{background-position:0% 50%} 50%{background-position:100% 50%} 100%{background-position:0% 50%} }

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.1);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

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

/* ===========================
   FORMS
   =========================== */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(99, 130, 241, 0.1);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4a843' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ===========================
   CARDS / PANELS
   =========================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.3s ease;
}

.card:hover {
  border-color: rgba(99, 130, 241, 0.3);
}

/* ===========================
   HEADER / NAVBAR
   =========================== */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(10, 10, 26, 0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 2px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.navbar-nav a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.3s;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--gold);
}

.navbar-user {
  display: none;
  align-items: center;
  gap: 12px;
}

.navbar-user.logged-in {
  display: flex;
}

#nav-auth {
  display: none;
}

#nav-auth.logged-out {
  display: flex;
  align-items: center;
  gap: 12px;
}

.credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 20px;
  font-size: 13px;
  color: #60a5fa;
  font-weight: 600;
}

/* ===========================
   CONTAINER / LAYOUT
   =========================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-sm {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===========================
   NOTIFICATIONS
   =========================== */

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  z-index: 9999;
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--purple); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===========================
   LOADING SPINNER
   =========================== */

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 130, 241, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===========================
   HAMBURGER MENU
   =========================== */

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 768px) {
  .navbar {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .navbar-toggle {
    display: block;
    order: 1;
  }

  .navbar-brand {
    order: 0;
    font-size: 20px;
  }

  .navbar-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 3;
    gap: 0;
    padding: 12px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
  }

  .navbar-nav.open {
    display: flex;
  }

  .navbar-nav li a,
  .navbar-nav a {
    display: block;
    padding: 10px 0;
    font-size: 15px;
  }

  .navbar-user.logged-in {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    order: 4;
    gap: 10px;
    padding: 12px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
  }

  .navbar-user.logged-in.open {
    display: flex;
  }

  #nav-auth.logged-out {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 4;
    gap: 8px;
    padding: 12px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
  }

  #nav-auth.logged-out.open {
    display: flex;
  }

  #nav-auth .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .container {
    padding: 0 16px;
  }

  .container-sm {
    padding: 0 16px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 13px;
  }

  .card {
    padding: 16px;
  }

  .auth-card {
    padding: 24px;
  }

  .auth-card h1 {
    font-size: 24px;
  }

  .toast {
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

/* ===========================
   AUTH PAGES
   =========================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: radial-gradient(ellipse at top, rgba(107, 47, 160, 0.15), transparent 60%),
              var(--bg-dark);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 28px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

.auth-card .btn {
  width: 100%;
  justify-content: center;
  padding: 14px;
  font-size: 16px;
}

.auth-card .auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ===========================
   ORNAMENTAL DIVIDER
   =========================== */

.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 32px 0;
  color: var(--text-dim);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
