/* ===== ALLFEAT DESIGN SYSTEM ===== */
/* Inspired by register.allfeat.org */

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

:root {
  /* Official Allfeat Brand Colors - Matching allfeat.org */
  --color-primary: #00DFC1;  /* Bright Allfeat Teal (allfeat.org) */
  --color-primary-hover: #00F9D9;
  --color-primary-light: rgba(0, 223, 193, 0.1);
  
  --color-accent: #FF3366;  /* Allfeat Red/Pink for accents */
  --color-accent-hover: #ff4a7a;
  --color-accent-light: rgba(255, 51, 102, 0.1);
  
  --color-burgundy: #6B3437;  /* Burgundy for special sections */
  
  /* Button text colors */
  --btn-primary-text: #FFFFFF;  /* White text on colored buttons (dark mode) */
  
  /* Dark theme (default) - Gradient background with softer transitions */
  --bg-primary: #000000;
  --bg-gradient-start: #2A5555;  /* Teal plus clair */
  --bg-gradient-mid-1: #1A3D3D;  /* Teal moyen */
  --bg-gradient-mid-2: #0F2626;  /* Teal foncé */
  --bg-gradient-mid-3: #0A0A0A;  /* Presque noir */
  --bg-gradient-end: #000000;
  --bg-secondary: #111111;
  --bg-card: rgba(26, 77, 77, 0.3);
  --bg-card-hover: rgba(26, 77, 77, 0.5);
  --border-color: rgba(0, 223, 193, 0.2);
  --border-color-hover: rgba(0, 223, 193, 0.4);
  --text-primary: #FFFBEB;  /* Warmer white like allfeat.org */
  --text-secondary: #D6D8DC;
  --text-muted: #999999;
  --footer-bg: #0A0A0A;
  --header-bg: #0A0A0A;  /* Dark header in dark mode */
  --header-border: rgba(0, 223, 193, 0.1);
}

/* Light theme - Matching register.allfeat.org */
[data-theme="light"] {
  /* Couleurs officielles de register.allfeat.org en light mode */
  --color-primary: #1B9B87;  /* hsl(172, 72%, 38%) - Teal foncé officiel */
  --color-primary-hover: #22B39E;  /* 10% plus clair */
  --color-primary-light: rgba(27, 155, 135, 0.1);
  
  /* Button text colors - White text on colored buttons */
  --btn-primary-text: #FFFFFF;
  
  --color-accent: #F87171;  /* Destructive color from register */
  --color-accent-hover: #EF4444;
  --color-accent-light: rgba(248, 113, 113, 0.1);
  
  --bg-primary: #FFFFFF;  /* Blanc pur comme register */
  --bg-secondary: #F9F9F9;  /* Très léger gris */
  --bg-card: #FFFFFF;
  --bg-card-hover: #F5F5F5;  /* hsl(0, 0%, 96.1%) */
  --border-color: #E5E5E5;  /* hsl(0, 0%, 89.8%) - Border officiel */
  --border-color-hover: #D4D4D4;
  --text-primary: #0A0A0A;  /* hsl(0, 0%, 3.9%) - Foreground officiel */
  --text-secondary: #525252;
  --text-muted: #6D7280;  /* hsl(220, 8%, 46%) - Muted officiel */
  --footer-bg: #F9F9F9;
  --header-bg: #FFFFFF;  /* White header in light mode */
  --header-border: #E5E5E5;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
  /* Support CJK characters properly */
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* Main layout - with sidebar */
main {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.container {
  flex: 1 0 auto;
  padding: 0 40px;
}

/* ===== HEADER ===== */
header {
  background: var(--header-bg);  /* White in light mode, dark in dark mode */
  border-bottom: 1px solid var(--header-border);
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  transition: background-color 0.3s, border-color 0.3s;
}

/* Header left with logo */
.header-left {
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo svg {
  height: 28px;
  width: auto;
}

.logo-img {
  height: 40px;
  width: auto;
}

.logo-text {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Noto Sans Mono CJK KR', monospace;
  font-size: 14px;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
  white-space: nowrap;
}

/* Language selector - matches register.allfeat.org */
.lang-selector-container {
  position: relative;
}

.lang-selector {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.lang-selector:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.lang-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
}

.lang-icon svg {
  width: 16px;
  height: 16px;
}

.lang-flag {
  font-size: 14px;
}

.lang-text {
  font-size: 14px;
  /* Fix CJK characters rendering */
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans JP", sans-serif;
  word-break: keep-all;
  white-space: nowrap;
  line-height: normal;
  display: inline-block;
  vertical-align: middle;
}

/* Language dropdown menu */
.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px;
  min-width: 160px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 200;
  animation: dropdown-appear 0.15s ease-out;
  overflow: visible;
}

@keyframes dropdown-appear {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
  /* Fix CJK characters rendering */
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans JP", sans-serif;
  word-break: keep-all;
  white-space: nowrap;
  overflow: visible;
  line-height: normal;
  min-height: 40px;
}

.lang-option:hover {
  background: var(--bg-card-hover);
}

.lang-option.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.lang-option .lang-flag {
  font-size: 16px;
}

/* Network selector (blockchain RPC) - Design sobre et élégant */
.network-selector-container {
  position: relative;
}

.network-selector {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.network-selector:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
}

/* Indicateur de statut réseau - point de couleur */
.network-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.2s;
  background: #6B7280; /* Gris par défaut (non connecté) */
}

.network-indicator.devnet,
.network-indicator.melodie {
  background: #10B981; /* Vert - Connecté */
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.network-text {
  font-size: 13px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Network dropdown menu */
.network-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px;
  min-width: 280px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 200;
  animation: dropdown-appear 0.15s ease-out;
}

.network-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.network-option:hover {
  background: var(--bg-card-hover);
  transform: translateX(2px);
}

.network-option.active {
  background: rgba(30, 215, 195, 0.1);
  border-left: 3px solid var(--color-primary);
  padding-left: 11px;
}

.network-option-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.network-name {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.network-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  padding-left: 18px;
  opacity: 0.7;
}

.network-option.active .network-name {
  color: var(--color-primary);
}

.network-option.active .network-url {
  color: var(--color-primary);
  opacity: 0.8;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle - exact match to register.allfeat.org */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
}

.theme-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.theme-icon svg {
  width: 18px;
  height: 18px;
}

/* Active icon (sun in light mode, moon in dark mode) */
.theme-icon.icon-active {
  color: #60A5FA;
}

.theme-switch {
  width: 44px;
  height: 24px;
  background: var(--border-color);
  border-radius: 12px;
  position: relative;
  transition: background 0.3s;
}

/* Switch turns teal when dark mode (checked) */
.theme-switch.checked {
  background: var(--color-primary);
}

.theme-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Knob moves to right when checked (dark mode) */
.theme-switch.checked::after {
  transform: translateX(20px);
}

/* ===== BUTTONS ===== */
.btn {
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--btn-primary-text);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--btn-primary-text);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ===== MAIN CONTAINER ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 40px;
}

/* ===== HERO SECTION ===== */
.hero {
  text-align: center;
  margin-bottom: 60px;
}

h1 {
  font-size: 48px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  transition: all 0.3s;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

/* ===== UPLOAD SECTION ===== */
.upload-section {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
}

.upload-section:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.upload-text {
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.upload-hint {
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== FILE VALIDATION SECTION ===== */
.file-validation-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
}

.file-info-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.file-info-header {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.file-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--color-primary-light);
  border-radius: 8px;
  color: var(--color-primary);
}

.file-icon-box svg {
  width: 32px;
  height: 32px;
}

.file-details {
  flex: 1;
}

.file-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
  word-break: break-word;
}

.file-size {
  font-size: 14px;
  color: var(--text-muted);
}

.file-validation-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.file-validation-actions .btn {
  min-width: 120px;
}

/* ===== PREVIEW SECTION ===== */
.preview-section {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  margin-top: 30px;
}

.preview-section.show {
  display: block;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.preview-title {
  font-size: 24px;
  color: var(--color-primary);
}

.preview-list {
  margin: 20px 0;
}

.preview-item {
  padding: 15px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.preview-item:hover {
  border-color: var(--color-primary);
}

.preview-item-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.preview-item-details {
  font-size: 14px;
  color: var(--text-muted);
}

.preview-footer {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 15;  /* Au-dessus de la pagination (z-index: 5-10) */
}

/* S'assurer que les boutons du footer sont cliquables */
.preview-footer .btn {
  position: relative;
  z-index: 16;
  pointer-events: auto;
}

.preview-footer .btn:hover {
  z-index: 17;  /* Au-dessus de tout au hover */
}

.preview-cost {
  font-size: 16px;
  color: var(--text-secondary);
}

/* ===== PROGRESS SECTION ===== */
.progress-section {
  display: none;
  margin-top: 30px;
}

.progress-section.show {
  display: block;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  transition: width 0.3s;
}

/* ===== LOGS PANEL ===== */
.logs-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin: 20px 0;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.logs-title {
  font-weight: 600;
  color: var(--text-primary);
}

.logs-clear {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.logs-clear:hover {
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

.logs-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Noto Sans Mono CJK KR', monospace;
  font-size: 13px;
  line-height: 1.5;
  word-break: keep-all;
}

.log-entry {
  padding: 4px 8px;
  border-radius: 4px;
  margin: 2px 0;
  animation: log-fade-in 0.2s ease-out;
}

@keyframes log-fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-info { color: var(--text-muted); }
.log-success { color: #4ADE80; }
.log-warning { color: #FCD34D; background: rgba(252, 211, 77, 0.1); }
.log-error { color: #F87171; background: rgba(248, 113, 113, 0.1); }

.logs-content::-webkit-scrollbar { width: 8px; }
.logs-content::-webkit-scrollbar-track { background: var(--bg-secondary); }
.logs-content::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.logs-content::-webkit-scrollbar-thumb:hover { background: var(--border-color-hover); }

/* ===== ICONS (SVG) ===== */
.confirm-icon svg,
.success-icon svg,
.upload-icon svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}

.confirm-icon svg {
  color: #FCD34D;  /* Warning yellow */
}

.success-icon svg {
  color: var(--color-primary);  /* Allfeat Teal */
}

.upload-icon svg {
  color: var(--color-primary);
}

/* ===== WALLET STATUS - exact match to register.allfeat.org ===== */
.wallet-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: #FFFFFF;
  color: #000000;
  border: 1px solid #E5E5E5;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 40px;
}

.wallet-status:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.wallet-status.connected {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
}

.wallet-icon {
  display: flex;
  align-items: center;
}

.wallet-icon svg {
  width: 18px;
  height: 18px;
}

/* ===== FOOTER ===== */
footer {
  background: var(--footer-bg);
  border-top: 1px solid var(--border-color);
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
  margin-top: auto;
  transition: background-color 0.3s, border-color 0.3s;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

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

.footer-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.rust-badge {
  color: var(--color-primary);
  font-weight: 600;
}

/* ===== WALLET MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modal-slide-up 0.3s ease-out;
}

@keyframes modal-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.wallet-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.wallet-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
}

.wallet-option:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  transform: translateY(-2px);
}

.wallet-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
}

.wallet-info {
  flex: 1;
}

.wallet-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.wallet-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

/* ===== HOW IT WORKS PAGE ===== */
.how-it-works-page {
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  text-align: center;
  margin-bottom: 48px;
}

.page-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  margin-top: 12px;
}

.protocol-intro {
  text-align: center;
  max-width: 900px;
  margin: 0 auto 64px;
  padding: 32px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.intro-text {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Core Principles - Horizontal Grid */
.principles-section {
  margin-bottom: 64px;
}

.principles-section h2 {
  text-align: center;
  margin-bottom: 32px;
}

.principles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.principle-card {
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s ease;
}

.principle-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--border-color-hover);
}

.principle-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border-radius: 12px;
}

.principle-icon svg {
  width: 32px;
  height: 32px;
  color: var(--accent-primary);
}

.principle-card h4 {
  margin-bottom: 16px;
  color: var(--text-primary);
}

.principle-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
}

/* Certification Process - Horizontal Steps */
.certification-section {
  margin-bottom: 64px;
}

.certification-section h2 {
  text-align: center;
  margin-bottom: 16px;
}

.section-intro {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 48px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.process-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 48px;
  position: relative;
}

.process-step {
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  position: relative;
  transition: all 0.3s ease;
}

.process-step:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--border-color-hover);
}

.process-step-number {
  position: absolute;
  top: -16px;
  left: 32px;
  width: 40px;
  height: 40px;
  background: var(--accent-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.step-icon {
  width: 56px;
  height: 56px;
  margin: 24px auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border-radius: 10px;
}

.step-icon svg {
  width: 28px;
  height: 28px;
  color: var(--accent-primary);
}

.process-step h4 {
  margin-bottom: 16px;
  color: var(--text-primary);
  text-align: center;
}

.process-step p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
}

/* Roles Section - Horizontal Grid */
.roles-section {
  margin-top: 48px;
  padding-top: 48px;
  border-top: 1px solid var(--border-color);
}

.roles-section h3 {
  text-align: center;
  margin-bottom: 32px;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

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

.role-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--border-color-hover);
}

.role-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  border-radius: 12px;
  border: 2px solid var(--border-color);
}

.role-icon svg {
  width: 32px;
  height: 32px;
  color: var(--accent-primary);
}

.role-card h4 {
  margin-bottom: 16px;
  color: var(--text-primary);
  font-size: 20px;
  text-align: center;
}

.role-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 14px;
  text-align: center;
}

/* Advantages Section */
.advantages-section {
  margin-top: 48px;
  padding: 32px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.advantages-section h3 {
  margin-bottom: 24px;
  color: var(--text-primary);
}

.advantages-list {
  list-style: none;
  padding: 0;
}

.advantages-list li {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  line-height: 1.6;
}

.advantages-list li:last-child {
  border-bottom: none;
}

.advantages-list strong {
  color: var(--accent-primary);
  font-weight: 600;
}

/* Responsive for How it Works */
@media (max-width: 1024px) {
  .principles-grid {
    grid-template-columns: 1fr;
  }
  
  .process-steps {
    grid-template-columns: 1fr;
  }
  
  .roles-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== UTILS ===== */
.hidden { display: none !important; }
.mt-20 { margin-top: 20px; }
.text-center { text-align: center; }

/* ===== PAGINATION CONTROLS ===== */
.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 15px;
  gap: 15px;
  flex-wrap: wrap;
  position: relative;    /* Pour le z-index */
  z-index: 5;            /* Au-dessus du contenu principal */
}

.pagination-top {
  margin-top: 0;
}

.pagination-bottom {
  margin-top: 15px;
  margin-bottom: 0;
}

.pagination-info {
  color: var(--text-secondary);
  font-size: 14px;
}

.pagination-info strong {
  color: var(--color-primary);
  font-weight: 600;
}

.pagination-size {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 14px;
}

.pagination-size select {
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.pagination-buttons {
  display: flex;
  gap: 10px;
}

.btn-pagination {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  pointer-events: auto;  /* Assurer que les boutons sont cliquables */
  position: relative;    /* S'assurer qu'ils sont au bon niveau de z-index */
  z-index: 10;          /* Au-dessus des autres éléments */
  white-space: nowrap;   /* Éviter le wrapping du texte */
}

.btn-pagination:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-pagination:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;  /* Désactiver vraiment les clics sur les boutons disabled */
}

/* ===== PREVIEW ITEM NUMBERING ===== */
.preview-item-number {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.preview-item.expanded .preview-item-number {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.preview-item-content {
  flex: 1;
}

.preview-item-header {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* ===== MODAL DIALOGS ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease-out;
}

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

/* ===== CONFIRMATION DIALOG ===== */
.confirm-dialog {
  text-align: center;
}

.confirm-icon {
  font-size: 60px;
  margin-bottom: 20px;
}

.confirm-dialog h2 {
  color: var(--text-primary);
  margin-bottom: 15px;
  font-size: 24px;
}

.confirm-message {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.confirm-count {
  background: var(--color-accent-light);
  border: 1px solid var(--color-accent);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 30px;
  color: var(--text-primary);
  font-size: 18px;
}

.confirm-count strong {
  color: var(--color-accent);
  font-size: 24px;
}

.confirm-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.confirm-buttons .btn {
  flex: 1;
}

/* ===== SUCCESS MESSAGE ===== */
.success-overlay {
  backdrop-filter: blur(4px);
}

.success-message {
  text-align: center;
}

.success-icon {
  font-size: 80px;
  margin-bottom: 20px;
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.success-message h2 {
  color: var(--color-primary);
  margin-bottom: 15px;
  font-size: 28px;
}

.success-count {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 25px;
}

.success-count strong {
  color: var(--color-primary);
  font-size: 32px;
  display: block;
  margin-bottom: 5px;
}

.tx-hash {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

.tx-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.tx-value {
  display: block;
  color: var(--color-primary);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  word-break: break-all;
  line-height: 1.6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  header {
    padding: 12px 20px;
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .header-right {
    flex-wrap: wrap;
  }
  
  .container {
    padding: 40px 20px;
  }
  
  h1 {
    font-size: 32px;
  }
  
  .subtitle {
    font-size: 16px;
  }
  
  footer {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}

/* ===== ERROR MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 40px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease-out;
  text-align: center;
}

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

.error-modal .error-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--color-accent-light);
  color: var(--color-accent);
  margin: 0 auto 20px;
}

.error-modal .error-icon svg {
  width: 36px;
  height: 36px;
  stroke-width: 2.5;
}

.error-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.error-message {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.error-actions .btn {
  min-width: 120px;
}

/* Modal close button (X in top right corner) */
.modal-close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
  z-index: 10;
}

.modal-close-button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.modal-close-button svg {
  width: 20px;
  height: 20px;
}

/* Confirmation modal styles */
.confirmation-modal {
  position: relative;
  text-align: center;
}

.confirmation-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.confirmation-message {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 32px;
}

.confirmation-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.wallet-connect-btn {
  min-width: 200px;
}

/* Responsive modal */
@media (max-width: 768px) {
  .modal-content {
    padding: 32px 24px;
    max-width: 90%;
  }
  
  .error-title {
    font-size: 20px;
  }
  
  .error-message {
    font-size: 14px;
  }
}
