/* CSS Variables */
:root {
  --bg-primary: #0a0e27;
  --bg-secondary: #141b3d;
  --bg-card: #1a2347;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-success: #10b981;
  --accent-danger: #ef4444;
  --border-color: rgba(99, 102, 241, 0.2);
  --shadow: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --shadow: rgba(0, 0, 0, 0.1);
}

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

html {
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.3s ease;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Floating Theme Toggle */
.theme-toggle-float {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 999;
  box-shadow: 0 4px 15px var(--shadow);
}

.theme-toggle-float i {
  width: 24px;
  height: 24px;
  color: var(--text-primary);
}

.theme-toggle-float:hover {
  border-color: var(--accent-primary);
  transform: scale(1.1) rotate(20deg);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

/* Header */
header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 30px 0 20px 0;
  margin-bottom: 20px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo {
  width: 50px;
  height: 50px;
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-secondary)
  );
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.logo i {
  width: 28px;
  height: 28px;
  color: white;
}

h1 {
  font-size: 2em;
  font-weight: 700;
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-secondary)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  color: var(--text-secondary);
  margin-top: 5px;
  font-size: 0.9em;
}

/* Search Section */
.search-section {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.search-bar {
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 16px 20px 16px 50px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 16px;
  transition: all 0.3s;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

/* Filter Section */
.filter-section {
  margin-bottom: 40px;
}

.filters-desktop {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.filters-mobile {
  display: none;
}

.filter-btn {
  padding: 10px 20px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.filter-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.filter-btn.active {
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-secondary)
  );
  border-color: transparent;
  color: white;
}

.category-dropdown {
  width: 100%;
  padding: 12px 20px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}

.category-dropdown:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.section-title {
  font-size: 2em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i {
  width: 32px;
  height: 32px;
  color: var(--accent-primary);
}

.results-count {
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 8px 16px;
  border-radius: 10px;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 50px;
  flex: 1;
}

.game-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px var(--shadow);
}

.game-image-container {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
}

.game-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mod-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.game-title {
  font-size: 0.95em;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-meta {
  color: var(--text-secondary);
  font-size: 0.75em;
  margin-bottom: 4px;
}

.game-tags {
  display: none;
}

.game-features {
  display: none;
}

.game-stats {
  display: flex;
  gap: 8px;
  margin: 6px 0 8px 0;
}

.game-stat {
  font-size: 0.7em;
  color: var(--text-secondary);
  font-weight: 400;
}

.download-btn {
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.85em;
  border: 1px solid var(--border-color);
}

.download-btn:hover {
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-secondary)
  );
  border-color: transparent;
  color: white;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  padding: 30px 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  gap: 30px;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 30px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.1em;
}

.footer-left p {
  color: var(--text-secondary);
  font-size: 0.9em;
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 25px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9em;
  transition: color 0.3s;
}

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

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 40px;
  max-width: 600px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 60px var(--shadow);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.close-btn i {
  width: 20px;
  height: 20px;
}

.close-btn:hover {
  transform: rotate(90deg);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

.modal-header {
  text-align: center;
  margin-bottom: 30px;
}

.modal-icon {
  width: 90px;
  height: 90px;
  margin: 0 auto 20px;
  border-radius: 20px;
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-secondary)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.modal-icon i {
  width: 45px;
  height: 45px;
  color: white;
}

.cta-text {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 25px;
  margin: 25px 0;
  text-align: center;
  line-height: 1.8;
}

.cta-text strong {
  color: var(--accent-primary);
  font-size: 1.2em;
}

.unlock-btn {
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    var(--accent-primary),
    var(--accent-secondary)
  );
  color: white;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.unlock-btn i {
  width: 20px;
  height: 20px;
}

.unlock-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 25px rgba(99, 102, 241, 0.6);
}

.download-ready {
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid var(--accent-success);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  margin: 20px 0;
}

.download-ready-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 15px;
  color: var(--accent-success);
}

.final-download-btn {
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-success), #059669);
  color: white;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.final-download-btn i {
  width: 20px;
  height: 20px;
}

.final-download-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.5);
}

.instructions {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
  font-size: 0.9em;
  color: var(--text-secondary);
  line-height: 1.8;
}

.instructions strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 12px;
}

.hidden {
  display: none;
}

/* Responsive */
@media (max-width: 1200px) {
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px;
  }
}

@media (max-width: 768px) {
  .theme-toggle-float {
    width: 45px;
    height: 45px;
    font-size: 20px;
  }

  h1 {
    font-size: 1.5em;
  }

  .section-title {
    font-size: 1.5em;
  }

  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
  }

  .filters-desktop {
    display: none;
  }

  .filters-mobile {
    display: block;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .footer {
    padding: 30px 0 15px 0;
  }

  .footer-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .footer-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 15px;
  }

  .game-title {
    font-size: 0.9em;
  }

  .game-meta {
    font-size: 0.7em;
  }

  .game-stat {
    font-size: 0.65em;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 15px;
  }

  .search-section {
    padding: 20px;
  }

  .modal-content {
    padding: 25px;
  }

  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .game-content {
    padding: 10px;
  }

  .game-title {
    font-size: 0.85em;
  }

  .game-meta {
    font-size: 0.65em;
  }

  .game-stats {
    flex-direction: column;
    gap: 2px;
    margin: 4px 0 6px 0;
  }

  .game-stat {
    font-size: 0.6em;
  }
}