﻿/* Base styling for consistent theme application */
* {
  box-sizing: border-box;
}

/* Apply gradient to html/* CS2 Server Stats - Colour Theme with Dark Mode Support */

/* Light Mode (Default) */
:root {
  /* Primary Colors - Light theme with greys */
  --primary-bg: #ffffff;            /* White background */
  --secondary-bg: #f8f9fa;          /* Very light grey background */
  --tertiary-bg: #e9ecef;           /* Light grey for cards/panels */
  --quaternary-bg: #dee2e6;         /* Medium light grey */

  /* Text Colors */
  --primary-text: #212529;          /* Dark grey/black text */
  --secondary-text: #6c757d;        /* Medium grey text */
  --tertiary-text: #adb5bd;         /* Light grey for less important text */

  /* Accent Colors - Greyscale theme */
  --accent-primary: #495057;        /* Dark grey accent */
  --accent-secondary: #6c757d;      /* Medium grey accent */
  --accent-light: #adb5bd;          /* Light grey accent */
  --accent-dark: #343a40;           /* Very dark grey */

  /* Border Colors */
  --border-primary: #dee2e6;        /* Light grey borders */
  --border-secondary: #e9ecef;      /* Very light borders */
  --border-accent: #6c757d;         /* Darker grey for highlighted borders */

  /* Interactive Elements */
  --hover-bg: #f8f9fa;              /* Light grey hover */
  --active-bg: #e9ecef;             /* Slightly darker for active */
  --focus-outline: #6c757d;         /* Grey focus outline */

  /* Shadows */
  --shadow-light: rgba(0, 0, 0, 0.075);
  --shadow-medium: rgba(0, 0, 0, 0.15);
  --shadow-heavy: rgba(0, 0, 0, 0.3);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
  --gradient-accent: linear-gradient(135deg, var(--tertiary-bg) 0%, var(--quaternary-bg) 100%);

  /* Transparency Variants */
  --primary-bg-80: rgba(255, 255, 255, 0.8);
  --secondary-bg-80: rgba(248, 249, 250, 0.8);
  --accent-primary-20: rgba(73, 80, 87, 0.2);
  --accent-primary-10: rgba(73, 80, 87, 0.1);

  /* Theme Toggle Button Colors */
  --toggle-bg: #dee2e6;
  --toggle-icon: #495057;
  --toggle-hover: #ced4da;

  /* Ranking Highlight Colors for Light Mode */
  --rank-1-bg: #fffacd;     /* Gold - light yellow */
  --rank-1-hover: #fff8c1;   /* Gold hover */
  --rank-2-bg: #e8f4fd;     /* Silver - light blue */
  --rank-2-hover: #d1edfc;   /* Silver hover */
  --rank-3-bg: #ffe8d1;     /* Bronze - light orange */
  --rank-3-hover: #ffdfc4;   /* Bronze hover */
}

/* Dark Mode */
[data-theme="dark"] {
  /* Primary Colors - Dark theme */
  --primary-bg: #1a1d23;            /* Dark background */
  --secondary-bg: #22262e;          /* Slightly lighter dark */
  --tertiary-bg: #2b3039;           /* Card/panel background */
  --quaternary-bg: #353a44;         /* Lighter dark grey */

  /* Text Colors */
  --primary-text: #e9ecef;          /* Light grey text */
  --secondary-text: #adb5bd;        /* Medium grey text */
  --tertiary-text: #6c757d;         /* Darker grey text */

  /* Accent Colors - Greyscale theme for dark */
  --accent-primary: #adb5bd;        /* Light grey accent */
  --accent-secondary: #868e96;      /* Medium grey accent */
  --accent-light: #6c757d;          /* Darker grey accent */
  --accent-dark: #ced4da;           /* Very light grey for emphasis */

  /* Border Colors */
  --border-primary: #353a44;        /* Dark grey borders */
  --border-secondary: #2b3039;      /* Darker borders */
  --border-accent: #868e96;         /* Lighter grey for highlighted borders */

  /* Interactive Elements */
  --hover-bg: #2b3039;              /* Darker hover */
  --active-bg: #353a44;             /* Lighter dark for active */
  --focus-outline: #868e96;         /* Grey focus outline */

  /* Shadows */
  --shadow-light: rgba(0, 0, 0, 0.2);
  --shadow-medium: rgba(0, 0, 0, 0.4);
  --shadow-heavy: rgba(0, 0, 0, 0.6);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
  --gradient-accent: linear-gradient(135deg, var(--tertiary-bg) 0%, var(--quaternary-bg) 100%);

  /* Transparency Variants */
  --primary-bg-80: rgba(26, 29, 35, 0.8);
  --secondary-bg-80: rgba(34, 38, 46, 0.8);
  --accent-primary-20: rgba(173, 181, 189, 0.2);
  --accent-primary-10: rgba(173, 181, 189, 0.1);

  /* Theme Toggle Button Colors */
  --toggle-bg: #353a44;
  --toggle-icon: #f8f9fa;
  --toggle-hover: #495057;

  /* Ranking Highlight Colors for Dark Mode */
  --rank-1-bg: #3d3a1f;     /* Gold - muted dark yellow */
  --rank-1-hover: #4a4625;   /* Gold hover */
  --rank-2-bg: #1f2f3d;     /* Silver - muted dark blue */
  --rank-2-hover: #263848;   /* Silver hover */
  --rank-3-bg: #3d2a1f;     /* Bronze - muted dark orange */
  --rank-3-hover: #4a3225;   /* Bronze hover */
}

/* Base styling for consistent theme application */
* {
  box-sizing: border-box;
}

/* Solid darker background for outer areas */
html {
  min-height: 100vh;
  /* Light mode - solid darker grey background */
  background-color: #dee2e6;
}

/* Dark mode - solid darker background */
[data-theme="dark"] html {
  background-color: #0d0f12;
}

body {
  background-color: transparent;
  color: var(--primary-text);
  margin: 0;
  padding: 0;
  transition: color 0.3s ease;
  min-height: 100vh;
}

/* Make container have the actual background */
.container {
  background-color: var(--primary-bg);
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] .container {
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
}

/* Smooth transitions for theme switching */
body,
.stats-section,
.profile-card,
.weapon-card,
.map-card,
.award-item,
.action-item,
.kill-item,
header,
.section-header,
.search-input,
.date-dropdown,
.search-button {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Utility classes for quick theme application */
.bg-primary { background-color: var(--primary-bg); }
.bg-secondary { background-color: var(--secondary-bg); }
.bg-tertiary { background-color: var(--tertiary-bg); }

.text-primary { color: var(--primary-text); }
.text-secondary { color: var(--secondary-text); }
.text-tertiary { color: var(--tertiary-text); }

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

.border-primary { border-color: var(--border-primary); }
.border-accent { border-color: var(--border-accent); }

/* Theme Toggle Button Styles */
.theme-toggle {
  position: relative;
  background-color: var(--toggle-bg);
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  padding: 8px 15px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--toggle-icon);
  margin-left: auto;
}

.theme-toggle:hover {
  background-color: var(--toggle-hover);
  border-color: var(--border-accent);
}

.theme-toggle-icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sun icon for light mode */
.theme-toggle .sun-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

/* Moon icon for dark mode */
.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

/* Logo styling - maintains white background in both themes */
.logo-container {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  display: inline-block;
  margin: 0 auto 10px auto;
  box-shadow: 0 2px 8px var(--shadow-light);
  transition: box-shadow 0.3s ease;
}

[data-theme="dark"] .logo-container {
  box-shadow: 0 2px 12px var(--shadow-medium);
}

.logo-container .logo {
  margin: 0;
}

/* Additional style adjustments for dark mode compatibility */
[data-theme="dark"] .search-error {
  background-color: rgba(255, 68, 68, 0.15);
  border-color: #ff6666;
  color: #ff9999;
}

[data-theme="dark"] .no-stats-message {
  background-color: rgba(255, 68, 68, 0.15);
  border-color: #ff6666;
  color: #ff9999;
}
