/* CSS Variables */
:root {
  /* ONE PIECE THEME COLORS */
  --bg-sand: #E8D5B5;
  --bg-cream: #F5E6D3;
  --wood-brown: #5C4033;
  --wood-light: #8B6914;
  --ocean-blue: #4A90A4;
  --ocean-dark: #2D5A6A;

  /* COLORS - Base */
  --bg-warm: #FDF6E3;
  --bg-dark: #1a1a2e;
  --card-white: #FFFFFF;
  --navy: #1A365D;
  --gold: #D69E2E;
  --gold-light: #ECC94B;
  --success: #38A169;
  --danger: #E53E3E;
  --warning: #DD6B20;
  --text-primary: #2D3748;
  --border-color: #E2E8F0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 8px;
  --radius-lg: 12px;

  /* ACCESSIBLE COLORS (WCAG AA - min 4.5:1 contrast ratio) */
  --text-secondary: #4B5563;  /* 7.0:1 on white */
  --text-muted: #6B7280;      /* 4.6:1 on white */

  /* SPACING SYSTEM (8px base) */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.5rem;   /* 24px */
  --space-6: 2rem;     /* 32px */
  --space-8: 3rem;     /* 48px */

  /* TYPOGRAPHY SCALE */
  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.25rem;   /* 20px */
  --text-2xl: 1.5rem;   /* 24px */
  --text-3xl: 2rem;     /* 32px */

  /* TOUCH TARGETS (WCAG 2.5.5 - min 44x44px) */
  --touch-min: 44px;

  /* FOCUS STATES */
  --focus-ring: 3px solid rgba(214, 158, 46, 0.5);
  --focus-ring-offset: 2px;

  /* Z-INDEX SCALE */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 1000;
  --z-toast: 1100;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Base */
html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(180deg, var(--bg-sand) 0%, var(--bg-cream) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--navy);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
  margin-bottom: 1rem;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.landing-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.landing-header {
  text-align: center;
  margin-bottom: 2rem;
}

.landing-header h1 {
  margin-bottom: 0.5rem;
}

.landing-info {
  text-align: center;
  margin-top: 2rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Cards */
.card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  margin-bottom: 1rem;
  text-align: center;
}

.landing-card {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  min-height: var(--touch-min);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: var(--text-base);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(214, 158, 46, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--navy);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #2D4A7C;
}

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

.btn-secondary:hover:not(:disabled) {
  background: #CBD5E0;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #2F855A;
}

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

.btn-danger:hover:not(:disabled) {
  background: #C53030;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy);
}

.btn-gold:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: var(--touch-min);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
}

.btn-xs {
  min-height: 36px;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.beta-badge {
  background: var(--gold);
  color: var(--navy);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.badge-success {
  background: #C6F6D5;
  color: var(--success);
}

.badge-danger {
  background: #FED7D7;
  color: var(--danger);
}

.badge-warning {
  background: #FEEBC8;
  color: var(--warning);
}

/* Messages */
.error-message {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  text-align: center;
}

.success-message {
  color: var(--success);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  text-align: center;
}

/* Utilities */
.hidden {
  display: none !important;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.divider::before {
  margin-right: 1rem;
}

.divider::after {
  margin-left: 1rem;
}

.rejoin-code-display {
  background: var(--navy);
  color: white;
  font-family: monospace;
  font-size: 1.5rem;
  letter-spacing: 0.25em;
  padding: 1rem;
  text-align: center;
  border-radius: var(--radius);
  margin: 1rem 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-warm);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ===== ACCESSIBILITY ===== */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Focus Visible (keyboard focus only) */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-3) var(--space-4);
  background: var(--navy);
  color: white;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
}

.skip-link:focus {
  top: var(--space-4);
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== RESPONSIVE (Mobile-First) ===== */

/* Base: 320px+ (Mobile) */
/* All base styles are mobile-first */

/* sm: 480px+ */
@media (min-width: 480px) {
  .container {
    padding: var(--space-5);
  }
}

/* md: 768px+ (Tablet) */
@media (min-width: 768px) {
  .container {
    padding: var(--space-6);
  }

  .landing-container {
    padding: var(--space-6) var(--space-4);
  }
}

/* lg: 1024px+ (Desktop) */
@media (min-width: 1024px) {
  .container {
    max-width: 80%;
  }
}

/* xl: 1280px+ */
@media (min-width: 1280px) {
  .container {
    max-width: 85%;
  }
}

/* xxl: 1600px+ (große Monitore) */
@media (min-width: 1600px) {
  .container {
    max-width: 90%;
  }
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Theme Colors */
    --bg-sand: #1a1a2e;
    --bg-cream: #16213e;
    --bg-warm: #1a1a2e;
    --bg-dark: #0f0f1a;
    --card-white: #252540;
    --navy: #7dd3fc;
    --gold: #fbbf24;
    --gold-light: #fcd34d;
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fb923c;
    --text-primary: #e5e7eb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);

    /* Dark Theme Accessible Colors */
    --wood-brown: #a78bfa;
    --wood-light: #c4b5fd;
    --ocean-blue: #67e8f9;
    --ocean-dark: #22d3ee;
  }

  /* Body background gradient for dark mode */
  body {
    background: linear-gradient(180deg, var(--bg-sand) 0%, var(--bg-cream) 100%);
    color: var(--text-primary);
  }

  /* Headings */
  h1, h2, h3, h4, h5, h6 {
    color: var(--navy);
  }

  /* Cards */
  .card {
    background: var(--card-white);
    border: 1px solid var(--border-color);
  }

  /* Form inputs */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="email"],
  select,
  textarea {
    background: var(--bg-dark);
    color: var(--text-primary);
    border-color: var(--border-color);
  }

  input:focus,
  select:focus,
  textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
  }

  /* Buttons */
  .btn-primary {
    background: var(--navy);
    color: var(--bg-dark);
  }

  .btn-primary:hover:not(:disabled) {
    background: #93c5fd;
  }

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

  .btn-secondary:hover:not(:disabled) {
    background: #4b5563;
  }

  /* Badges */
  .badge-success {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
  }

  .badge-danger {
    background: rgba(248, 113, 113, 0.2);
    color: var(--danger);
  }

  .badge-warning {
    background: rgba(251, 146, 60, 0.2);
    color: var(--warning);
  }

  .beta-badge {
    background: var(--gold);
    color: var(--bg-dark);
  }

  /* Rejoin code display */
  .rejoin-code-display {
    background: var(--bg-dark);
    color: var(--gold);
    border: 1px solid var(--border-color);
  }

  /* Scrollbar */
  ::-webkit-scrollbar-track {
    background: var(--bg-dark);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--border-color);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
  }

  /* Skip link */
  .skip-link {
    background: var(--gold);
    color: var(--bg-dark);
  }

  /* Focus ring adjustment for dark mode */
  :focus-visible {
    outline: 3px solid rgba(251, 191, 36, 0.6);
  }

  /* Divider */
  .divider::before,
  .divider::after {
    border-color: var(--border-color);
  }
}
