/**
 * Fire Foundation - Main Styles
 * Tema: Fogo / Fire Foundation
 */

/* ========== CSS Variables ========== */
:root {
  /* Colors */
  --primary: #FF4500;
  --primary-dark: #CC3700;
  --primary-light: #FF6B35;
  --secondary: #FF6B35;
  --accent: #FFD700;
  --accent-dark: #DAA520;

  --bg-dark: #1A0A00;
  --bg-surface: #2D1810;
  --bg-surface-light: #3D2820;
  --bg-card: #251510;

  --text-primary: #FFF5E6;
  --text-secondary: #CCAA88;
  --text-muted: #887766;

  --success: #4CAF50;
  --success-dark: #388E3C;
  --danger: #FF1744;
  --danger-dark: #D50000;
  --warning: #FFC107;

  /* Shadows & Effects */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(255, 69, 0, 0.3);
  --shadow-glow-accent: 0 0 20px rgba(255, 215, 0, 0.3);

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* Fire background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at bottom, rgba(255, 69, 0, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse at top right, rgba(255, 107, 53, 0.05) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-light);
}

img {
  max-width: 100%;
  height: auto;
}

/* ========== Typography ========== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
  text-shadow: 0 2px 10px rgba(255, 69, 0, 0.3);
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: var(--space-md);
}

.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.text-center { text-align: center; }
.text-right { text-align: right; }

/* ========== Layout ========== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.page {
  padding: var(--space-lg) 0;
  padding-bottom: 100px;
}

.grid {
  display: grid;
  gap: var(--space-md);
}

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

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

.flex {
  display: flex;
}

.flex-wrap { flex-wrap: wrap; }
.flex-center { justify-content: center; align-items: center; }
.flex-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ========== Header ========== */
.header {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-dark) 100%);
  border-bottom: 2px solid var(--primary);
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md), 0 2px 20px rgba(255, 69, 0, 0.2);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon {
  font-size: 2rem;
  animation: flicker 2s infinite alternate;
}

@keyframes flicker {
  0%, 100% { opacity: 1; text-shadow: 0 0 10px var(--primary); }
  50% { opacity: 0.9; text-shadow: 0 0 20px var(--accent); }
}

/* ========== Navigation ========== */
.nav {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.nav-link {
  padding: var(--space-sm) var(--space-md);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  font-weight: 500;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 69, 0, 0.1);
}

.nav-link.active {
  color: var(--accent);
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: var(--space-xs);
  }

  .nav.open {
    display: flex;
  }

  .nav-link {
    padding: var(--space-md);
    text-align: center;
    border: 1px solid var(--bg-surface-light);
  }
}

/* ========== Cards ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--bg-surface-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--bg-surface-light);
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-body {
  padding: var(--space-sm) 0;
}

/* Stat Cards */
.stat-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--bg-surface-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.stat-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-sm);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: var(--space-xs);
}

/* ========== Tables ========== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg-surface-light);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
}

th, td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--bg-surface-light);
}

th {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

tr:hover {
  background: rgba(255, 69, 0, 0.05);
}

tr.highlight-warning {
  background: rgba(255, 193, 7, 0.1);
  border-left: 3px solid var(--warning);
}

tr.highlight-danger {
  background: rgba(255, 23, 68, 0.1);
  border-left: 3px solid var(--danger);
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover {
  background: rgba(255, 69, 0, 0.1);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 2px 10px rgba(255, 69, 0, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.4);
}

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

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

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--bg-dark);
}

.btn-accent:hover {
  box-shadow: var(--shadow-glow-accent);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
  color: white;
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1.125rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ========== Forms ========== */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 69, 0, 0.2);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23CCAA88' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: 40px;
}

/* File input */
.file-input-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-input-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--bg-surface);
  border: 2px dashed var(--bg-surface-light);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.file-input-label:hover {
  border-color: var(--primary);
  color: var(--text-primary);
}

/* ========== Badges ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.badge-success {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success);
  border: 1px solid var(--success);
}

.badge-danger {
  background: rgba(255, 23, 68, 0.2);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.badge-warning {
  background: rgba(255, 193, 7, 0.2);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.badge-primary {
  background: rgba(255, 69, 0, 0.2);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.badge-accent {
  background: rgba(255, 215, 0, 0.2);
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ========== Progress Bar ========== */
.progress {
  height: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-sm);
  transition: width var(--transition-slow);
}

.progress-bar.danger {
  background: linear-gradient(90deg, var(--danger) 0%, var(--danger-dark) 100%);
}

.progress-bar.success {
  background: linear-gradient(90deg, var(--success) 0%, var(--success-dark) 100%);
}

/* ========== Alerts ========== */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.alert-icon {
  font-size: 1.25rem;
}

.alert-warning {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid var(--warning);
  color: var(--warning);
}

.alert-danger {
  background: rgba(255, 23, 68, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.alert-success {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}

.alert-info {
  background: rgba(255, 69, 0, 0.1);
  border: 1px solid var(--primary);
  color: var(--primary-light);
}

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--bg-surface-light);
}

.modal-title {
  margin-bottom: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-lg);
  border-top: 1px solid var(--bg-surface-light);
}

/* ========== Tabs ========== */
.tabs {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 2px solid var(--bg-surface-light);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}

.tab {
  padding: var(--space-md) var(--space-lg);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========== Loading ========== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-surface-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Fire loader animation */
.fire-loader {
  font-size: 3rem;
  animation: fireGlow 1s ease-in-out infinite alternate;
}

@keyframes fireGlow {
  0% {
    text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
    transform: scale(1);
  }
  100% {
    text-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent);
    transform: scale(1.1);
  }
}

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

/* ========== Chart Container ========== */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

/* ========== Filters ========== */
.filters {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.filter-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ========== Admin Bar ========== */
.admin-bar {
  background: linear-gradient(90deg, var(--accent-dark) 0%, var(--accent) 100%);
  color: var(--bg-dark);
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  font-weight: 600;
  display: none;
}

.admin-bar.active {
  display: block;
}

/* Admin button in header */
.admin-btn {
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.admin-btn:hover {
  background: rgba(255, 215, 0, 0.1);
}

.admin-btn.active {
  background: var(--accent);
  color: var(--bg-dark);
}

/* ========== Section Headers ========== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ========== Last Update ========== */
.last-update {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ========== Member Card (for grid view) ========== */
.member-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-surface-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  transition: all var(--transition-normal);
  cursor: pointer;
}

.member-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.member-name {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
}

.member-stats {
  display: flex;
  gap: var(--space-md);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.member-stat {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* ========== War Result Card ========== */
.war-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--bg-surface-light);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
}

.war-result.victory {
  border-left: 4px solid var(--success);
}

.war-result.defeat {
  border-left: 4px solid var(--danger);
}

.war-clans {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.war-clan {
  text-align: center;
}

.war-clan-name {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.war-clan-score {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.war-vs {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-muted);
}

.war-meta {
  text-align: right;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ========== Responsive Utilities ========== */
.hide-mobile {
  display: block;
}

.show-mobile {
  display: none;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }

  .show-mobile {
    display: block;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .card {
    padding: var(--space-md);
  }

  .filters {
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group .form-select {
    flex: 1;
  }
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--bg-surface-light);
  border-radius: var(--radius-sm);
}

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

/* ========== Toast Notifications ========== */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-surface);
  border: 1px solid var(--bg-surface-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--danger);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========== Image Preview ========== */
.image-preview {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--bg-surface-light);
  margin-top: var(--space-sm);
}
