/* ============================================
   REDRAG Game Storage Planner - Styles
   Theme: Dark Gaming Aesthetic
   ============================================ */

:root {
  --primary: #ff3333;
  --primary-dark: #cc0000;
  --primary-light: #ff6666;
  --bg-dark: #0d0d0d;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --bg-input: #141414;
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #666666;
  --border: #2a2a2a;
  --border-light: #333333;
  --success: #00c853;
  --warning: #ffd600;
  --danger: #ff1744;
  --info: #2979ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --transition: all 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
.header {
  background: linear-gradient(135deg, #1a0000 0%, #0d0d0d 100%);
  border-bottom: 2px solid var(--primary);
  padding: 20px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

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

.logo-icon {
  width: 42px;
  height: 42px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

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

.logo-text span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 25px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a:hover {
  color: var(--primary);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #1a0000 0%, #0d0d0d 50%, #0a0a1a 100%);
  padding: 60px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero h1 .highlight {
  color: var(--primary);
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 30px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 51, 51, 0.15);
  border: 1px solid rgba(255, 51, 51, 0.3);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 14px;
  color: var(--primary-light);
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Tool Section */
.tool-section {
  padding: 40px 0;
}

.tool-wrapper {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 30px;
  align-items: start;
}

@media (max-width: 900px) {
  .tool-wrapper {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title .icon {
  width: 32px;
  height: 32px;
  background: rgba(255, 51, 51, 0.15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Search & Filters */
.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 14px 18px 14px 48px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-box::before {
  content: "🔍";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.6;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  background: rgba(255, 51, 51, 0.2);
  border-color: var(--primary);
  color: var(--primary-light);
}

/* Game List */
.game-list {
  max-height: 450px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}

.game-list::-webkit-scrollbar {
  width: 6px;
}

.game-list::-webkit-scrollbar-track {
  background: var(--bg-input);
}

.game-list::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

.game-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  gap: 12px;
}

.game-item:hover {
  background: var(--bg-card-hover);
}

.game-item.selected {
  background: rgba(255, 51, 51, 0.1);
  border-left: 3px solid var(--primary);
}

.game-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.game-info {
  flex: 1;
  min-width: 0;
}

.game-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.game-size {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-light);
  flex-shrink: 0;
}

.game-count {
  text-align: center;
  padding: 12px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* Storage Selector */
.storage-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.storage-btn {
  padding: 16px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.storage-btn:hover {
  border-color: var(--border-light);
}

.storage-btn.active {
  border-color: var(--primary);
  background: rgba(255, 51, 51, 0.15);
  color: var(--text-primary);
}

.storage-btn .size {
  font-size: 20px;
  font-weight: 800;
  display: block;
}

.storage-btn .label {
  font-size: 12px;
  opacity: 0.7;
}

/* Platform Selector */
.platform-options {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.platform-btn {
  flex: 1;
  padding: 12px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  font-weight: 600;
}

.platform-btn.active {
  border-color: var(--info);
  background: rgba(41, 121, 255, 0.15);
  color: var(--info);
}

/* Results Panel */
.results-panel {
  position: sticky;
  top: 100px;
}

.result-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.result-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.result-header h3 {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.result-header .big-number {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.result-header .big-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Progress Bar */
.progress-container {
  margin: 20px 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.progress-bar-bg {
  height: 24px;
  background: var(--bg-input);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.6s ease, background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  min-width: 40px;
}

.progress-bar-fill.safe { background: linear-gradient(90deg, var(--success), #00e676); }
.progress-bar-fill.warning { background: linear-gradient(90deg, var(--warning), #ffab00); color: #000; }
.progress-bar-fill.danger { background: linear-gradient(90deg, var(--danger), #ff5252); }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.stat-box .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-box .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Insight Box */
.insight-box {
  background: rgba(41, 121, 255, 0.1);
  border: 1px solid rgba(41, 121, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.insight-box .insight-title {
  font-weight: 700;
  color: var(--info);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.insight-box.danger {
  background: rgba(255, 23, 68, 0.1);
  border-color: rgba(255, 23, 68, 0.3);
}

.insight-box.danger .insight-title {
  color: var(--danger);
}

/* Action Buttons */
.action-btns {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 51, 51, 0.3);
}

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

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

/* Selected Games Summary */
.selected-games {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.selected-game-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}

.selected-game-item .remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
}

/* Content Sections */
.content-section {
  padding: 60px 0;
  border-top: 1px solid var(--border);
}

.content-section h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.content-section h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 30px 0 15px;
  color: var(--text-primary);
}

.content-section p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 16px;
}

.content-section ul,
.content-section ol {
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-left: 24px;
}

.content-section li {
  margin-bottom: 8px;
}

.content-section a {
  color: var(--primary-light);
  text-decoration: none;
}

.content-section a:hover {
  text-decoration: underline;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--bg-input);
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.data-table tr:hover {
  background: var(--bg-card-hover);
}

.data-table td {
  color: var(--text-secondary);
}

/* FAQ */
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-question {
  padding: 18px 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.faq-question:hover {
  background: var(--bg-card-hover);
}

.faq-question::after {
  content: "+";
  font-size: 20px;
  color: var(--primary);
  transition: var(--transition);
}

.faq-item.active .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.faq-item.active .faq-answer {
  padding: 0 20px 18px;
  max-height: 500px;
}

/* Related Guides */
.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

.guide-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.guide-card h4 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.guide-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

/* Footer */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 20px;
  text-align: center;
  margin-top: 60px;
}

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

.footer a {
  color: var(--primary-light);
  text-decoration: none;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--primary);
  color: var(--text-primary);
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transition: all 0.4s ease;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .hero {
    padding: 40px 20px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .storage-options {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .nav-links {
    display: none;
  }

  .card {
    padding: 18px;
  }

  .content-section h2 {
    font-size: 22px;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }
}

/* Print */
@media print {
  .header, .footer, .action-btns, .search-box, .filter-row {
    display: none;
  }

  .tool-wrapper {
    grid-template-columns: 1fr;
  }

  .results-panel {
    position: static;
  }
}
