/* ============================================
   War Inc: Rising Tier List - Base Styles
   Variables, Reset, Touch, Body, Header
   ============================================ */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Global focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Theme Variables */
:root {
  /* Dark theme (default) */
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #2a2a4a;
  --bg-card: #16213e;
  --text-primary: #fff;
  --text-secondary: #aaa;
  --text-muted: #666;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.3);

  /* Category Colors - Bright borders by default */
  /* Mythic - Red */
  --cat-mythic: #ff6b6b;
  --cat-mythic-hover: #ff4444;
  --cat-mythic-glow: rgba(255, 68, 68, 0.4);
  /* Legendary - Gold */
  --cat-legendary: #ffd93d;
  --cat-legendary-hover: #ffd700;
  --cat-legendary-glow: rgba(255, 215, 0, 0.4);
  /* Epic - Purple */
  --cat-epic: #9932cc;
  --cat-epic-hover: #b366e0;
  --cat-epic-glow: rgba(153, 50, 204, 0.4);
  /* Rare - Blue */
  --cat-rare: #00aaff;
  --cat-rare-hover: #33bbff;
  --cat-rare-glow: rgba(0, 170, 255, 0.4);
  /* Common - Gray */
  --cat-common: #708090;
  --cat-common-hover: #8a9aa8;
  --cat-common-glow: rgba(112, 128, 144, 0.4);

  /* Accent/Interactive Colors */
  --color-accent: #f39c12;
  --color-accent-hover: #d68910;
  --color-focus: #f39c12;

  /* Status Colors */
  --color-success: #2ecc71;
  --color-success-bg: #2d6a4f;
  --color-danger: #e74c3c;
  --color-danger-bg: #9c3535;
  --color-warning: #f39c12;
  --color-warning-bg: #8a6a4a;
  --color-info: #3498db;
  --color-info-bg: #4a6a8a;

  /* Admin Panel */
  --admin-bg: linear-gradient(135deg, #3a2a4a 0%, #2a3a4a 100%);
  --admin-border: #6a5a8a;
  --admin-title: #c9b037;
  --admin-input-bg: #1a1a2e;
  --admin-input-border: #4a4a6a;

  /* Interactive State Colors */
  --bg-interactive-hover: #3a3a5a;
  --bg-active: #4a4a8a;
  --bg-active-hover: #5a5a9a;
  --border-active: #6a6aaa;
  --color-highlight: #4a90d9;
  --color-highlight-glow: rgba(74, 144, 217, 0.2);

  /* Logo */
  --logo-border: #4a4a8a;
  --logo-glow: rgba(74, 74, 138, 0.5);
}

/* Light theme */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e4e6eb;
  --bg-card: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #555;
  --text-muted: #888;
  --border-color: rgba(0, 0, 0, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.1);

  /* Accent/Interactive Colors */
  --color-accent: #d68910;
  --color-accent-hover: #b8760d;
  --color-focus: #d68910;

  /* Status Colors - brighter for light bg */
  --color-success-bg: #40916c;
  --color-danger-bg: #c04040;
  --color-warning-bg: #c9a227;
  --color-info-bg: #5c8db5;

  /* Interactive State Colors */
  --bg-interactive-hover: #c8ccd0;
  --bg-active: #4a4a8a;
  --bg-active-hover: #5a5a9a;
  --border-active: #6a6aaa;
  --color-highlight: #4a90d9;
  --color-highlight-glow: rgba(74, 144, 217, 0.2);

  /* Admin Panel - Light Theme */
  --admin-bg: linear-gradient(135deg, #f8f8fc 0%, #f0f4f8 100%);
  --admin-border: #c8ccd8;
  --admin-title: #8b7320;
  --admin-input-bg: #ffffff;
  --admin-input-border: rgba(0, 0, 0, 0.15);

  /* Logo - Light Theme */
  --logo-border: #6a6aaa;
  --logo-glow: rgba(74, 74, 138, 0.3);
}

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

/* ============================================
   Touch Device Optimizations
   ============================================ */

/* Disable 300ms tap delay on all elements */
* {
  touch-action: manipulation;
}

/* Disable tap highlight on interactive elements */
a, button, .icon, .tier, .tier-label, .category-tab, .mode-btn, .btn, .category-btn, .create-mode-btn, .icon-btn {
  -webkit-tap-highlight-color: transparent;
}

/* Prevent long-press context menu on hero icons */
.icon {
  -webkit-touch-callout: none;
}

/* SEO Content - Hidden visually but readable by search engines */
.seo-content {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Page-specific nav override */
.nav {
  margin: 0 -15px 0 -15px;
}

body {
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 0 15px 15px;
  transition: background 0.4s ease, color 0.3s ease;
}

main {
  flex: 1;
  padding-top: 15px;
}

/* Main content container — mobile-first */
.main-container {
  margin: 0 auto;
}

@media (min-width: 601px) {
  .main-container {
    padding: 0 15px;
  }
}

@media (min-width: 901px) {
  .main-container {
    padding: 0 40px;
    max-width: 1400px;
  }
}

@media (min-width: 1200px) {
  .main-container {
    max-width: 1600px;
  }
}

/* ============================================
   Hero Section Card
   ============================================ */
.hero-section {
  background: var(--bg-card);
  padding: 20px 16px 12px;
  margin: 0 -15px 16px;
  max-width: 800px;
  box-shadow: 0 4px 24px var(--shadow-color);
  border: 1px solid var(--border-color);
  border-left: none;
  border-right: none;
}

[data-theme="light"] .hero-section {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

@media (min-width: 601px) {
  .hero-section {
    border-radius: 16px;
    padding: 24px 20px 16px;
    margin: 0 auto 24px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }
}

/* ============================================
   Header
   ============================================ */
.header {
  text-align: center;
  margin-bottom: 16px;
  padding: 0;
}

.header-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 10px;
  border: 3px solid var(--logo-border);
  box-shadow: 0 0 20px var(--logo-glow);
}

h1 {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 5px;
}

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

/* ============================================
   Utilities
   ============================================ */
input[type="file"] { display: none; }

.hidden { display: none !important; }

/* ============================================
   Global Responsive — Desktop Overrides
   ============================================ */
@media (min-width: 601px) {
  .icon {
    width: 70px;
    height: 70px;
    margin: 4px;
  }

  .tier-label {
    width: 70px;
    font-size: 24px;
  }

  .btn {
    padding: 12px 22px;
    font-size: 15px;
  }

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

@media (min-width: 901px) {
  .icon {
    width: 80px;
    height: 80px;
  }

  .tier-label {
    font-size: 28px;
  }
}

/* Touch device specific styles */
@media (hover: none) and (pointer: coarse) {
  /* Disable hover transform on touch devices (it sticks after tap) */
  .icon:hover {
    transform: none;
  }

  /* Keep selected state transform */
  .icon.selected {
    transform: scale(1.05);
  }

  /* Ensure adequate tap target sizes */
  .btn, .mode-btn, .category-tab, .category-btn {
    min-height: 44px;
  }
}
