/* ==========================================================================
   KURA MAIL - MODERN & DYNAMIC MAIL SYSTEM (TAG-DIRECT STYLING)
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-card: #151c2c;
  --bg-card-hover: #1e293b;
  --bg-nav: rgba(21, 28, 44, 0.85);
  
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.35);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Background */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   NAVBAR / TOP HEADER (Style automatique des liens du haut)
   ========================================================================== */

header, nav, body > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  background: var(--bg-nav);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}

/* Liens de navigation */
header a, nav a, body > div:first-child a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  padding: 8px 16px;
  border-radius: var(--radius);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

header a:hover, nav a:hover, body > div:first-child a:hover {
  color: var(--text-primary);
  background-color: var(--bg-card-hover);
  transform: translateY(-1px);
}

/* Marque / Titre principal (Kura Mail) */
header a:first-child, nav a:first-child, body > div:first-child a:first-child, .brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-left: 0;
  margin-right: 16px;
}

header a:first-child:hover, nav a:first-child:hover {
  background: linear-gradient(135deg, #a5b4fc, #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Bouton Écrire / Nouveau message automatique */
a[href*="new"], a[href*="ecrire"], a[href*="écrire"], a[href*="compose"], .btn-compose {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover)) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 14px var(--accent-glow);
  margin-left: auto;
}

a[href*="new"]:hover, a[href*="ecrire"]:hover, a[href*="écrire"]:hover {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow: 0 6px 20px var(--accent-glow) !important;
}

/* ==========================================================================
   CONTENU PRINCIPAL & CARTES
   ========================================================================== */

main, container, .container, body > div:nth-child(2) {
  flex: 1;
  max-width: 1000px;
  width: 92%;
  margin: 32px auto;
  animation: slideUp 0.4s ease-out;
}

/* Message "Rien ici pour l'instant" / Empty State */
p {
  color: var(--text-secondary);
  line-height: 1.6;
}

main > p, .container > p, body > div:nth-child(2) > p {
  background: var(--bg-card);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 50px 24px;
  text-align: center;
  font-size: 1.05rem;
  color: var(--text-muted);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  margin-top: 20px;
  position: relative;
  overflow: hidden;
}

main > p::before, .container > p::before {
  content: "✉️";
  display: block;
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.6;
  animation: float 3s ease-in-out infinite;
}

/* ==========================================================================
   LISTE DES EMAILS / TABLEAUX
   ========================================================================== */

ul, ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

li, tr, .email-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: slideUp 0.3s ease-out;
}

li:hover, tr:hover, .email-item:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px) scale(1.005);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   FORMULAIRES & BOUTONS
   ========================================================================== */

form {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

input, textarea, select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(11, 15, 25, 0.95);
}

button, input[type="submit"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px var(--accent-glow);
  align-self: flex-start;
}

button:hover, input[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
  filter: brightness(1.1);
}

/* ==========================================================================
   ANIMATIONS & EFFETS
   ========================================================================== */

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
