/* ==========================================================================
   Design System — CSS Custom Properties
   ========================================================================== */

:root {
  /* --- Color Palette --- */
  /* Primary (orange/brown theme) */
  --color-primary: #df5f04;
  --color-primary-dark: #882d00;
  --color-primary-darker: #5e150b;
  --color-primary-light: #ffa400;

  /* Background */
  --color-bg-dark: #000000;
  --color-bg-panel: rgba(0, 0, 0, 0.85);
  --color-bg-sidebar: #2b190f;
  --color-bg-menu: #2d1b11;
  --color-bg-input: #0a0705;
  --color-bg-hover: #3c1d0b;

  /* Text */
  --color-text-gold: #ffa400;
  --color-text-white: #ffffff;
  --color-text-beige: #c69b6d;
  --color-text-muted: #8a7a6a;

  /* Borders */
  --color-border: #4f1f0a;
  --color-border-accent: #c34506;
  --color-border-light: #582605;
  --color-border-gold: #BF6530;

  /* Game resources */
  --color-gold: #ffa400;
  --color-food: #f28e2d;
  --color-wood: #8c3108;
  --color-iron: #657b96;
  --color-mana: #1c94c4;
  --color-turns: greenyellow;
  --color-xp: darkorchid;

  /* Semantic */
  --color-success: #4CAF50;
  --color-danger: #e74c3c;
  --color-warning: #f39c12;
  --color-info: #1c94c4;

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

  /* --- Typography --- */
  --font-ui: 'Inter', 'Tahoma', 'Arial', sans-serif;
  --font-display: 'Inter', 'Tahoma', 'Arial', sans-serif;

  --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 */

  --leading-tight: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* --- Border Radius --- */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 15px;
  --radius-full: 9999px;

  /* --- Shadows --- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  /* --- Transitions --- */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;

  /* --- Z-index layers --- */
  --z-base: 1;
  --z-menu: 99;
  --z-sidebar: 100;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-loader: 2000;
}

/* ==========================================================================
   Consolidated Button System
   ========================================================================== */

.btn--primary,
.btn--secondary,
.btn--danger,
.btn--success {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: var(--leading-normal);
  text-align: center;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.btn--primary:active,
.btn--secondary:active,
.btn--danger:active,
.btn--success:active {
  transform: scale(0.97);
}

/* Primary — orange gradient (default game button) */
.btn--primary {
  background: linear-gradient(to bottom, #862e05 5%, #5e150b 100%);
  border-color: var(--color-border-accent);
  color: var(--color-text-white);
}
.btn--primary:hover {
  background: linear-gradient(to bottom, #5e150b 5%, #862e05 100%);
}

/* Secondary — dark/muted */
.btn--secondary {
  background: var(--color-bg-menu);
  border-color: var(--color-border);
  color: var(--color-text-beige);
}
.btn--secondary:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-white);
}

/* Danger — red */
.btn--danger {
  background: linear-gradient(to bottom, #8b1a1a 5%, #5c0e0e 100%);
  border-color: #a02020;
  color: var(--color-text-white);
}
.btn--danger:hover {
  background: linear-gradient(to bottom, #5c0e0e 5%, #8b1a1a 100%);
}

/* Success — green */
.btn--success {
  background: linear-gradient(to bottom, #74ad5a 5%, #68a54b 100%);
  border-color: #3b6e22;
  color: var(--color-text-white);
}
.btn--success:hover {
  background: linear-gradient(to bottom, #23a54b 5%, #74ad5a 100%);
}

/* ==========================================================================
   CSS Spinner (replaces loader2.gif)
   ========================================================================== */

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.spinner--lg {
  width: 80px;
  height: 80px;
  border-width: 5px;
}

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

/* ==========================================================================
   Loading Skeleton
   ========================================================================== */

.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton--text {
  height: 1em;
  width: 80%;
  margin-bottom: var(--space-2);
}

.skeleton--box {
  height: 80px;
  width: 100%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==========================================================================
   Visual Polish — Hover Effects & Transitions
   ========================================================================== */

/* Smooth link transitions */
a {
  transition: color var(--transition-fast);
}

/* Card hover lift */
.card-hover {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Notification pop-in */
@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.pop-in {
  animation: popIn 0.3s ease-out;
}

/* Fade in */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

/* Page content entrance */
#main_game_window .content {
  animation: fadeIn 0.3s ease-out;
}
