/* ===== CSS VARIABLES FOR THEMING ===== */
:root {
  --primary-bg: #333;
  --secondary-bg: #444;
  --accent-color: #555;
  --text-dark: #000;
  --text-light: #fff;
  --bg-dark: #000;
  --bg-light: #f0f0f0;
  --border-color: #666;
}

html[data-theme="light"] {
  --text-dark: #fff;
  --text-light: #000;
  --bg-dark: #f0f0f0;
  --bg-light: #000;
  --border-color: #ccc;
}

/* ===== GENERAL STYLES ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-dark);
  color: var(--text-light);
  font-family: Arial, sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== LOGIN PAGE ===== */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: rgba(255, 255, 255, 0.1);
  padding: 40px;
  border-radius: 10px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  min-width: 300px;
}

.login-box h1 {
  font-size: 40px;
  margin-bottom: 40px;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.login-box h2 {
  color: white;
  margin-bottom: 20px;
}

.login-box input {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: none;
  border-radius: 5px;
  font-size: 16px;
}

.login-box button {
  width: 100%;
  padding: 12px;
  margin-top: 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.login-box button:hover {
  background: #764ba2;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* ===== HEADER & NAV ===== */
header {
  background: var(--secondary-bg);
  padding: 20px;
  text-align: center;
  font-size: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--accent-color);
  transition: all 0.3s ease;
}

header h1 {
  margin: 0;
  flex: 1;
  text-align: center;
}

.header-controls {
  display: flex;
  gap: 10px;
}

.header-controls button {
  background: var(--accent-color);
  border: none;
  color: var(--text-light);
  padding: 10px 15px;
  font-size: 20px;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.3s ease;
}

.header-controls button:hover {
  background: var(--primary-bg);
  transform: scale(1.1);
}

nav {
  background: var(--primary-bg);
  padding: 10px;
  text-align: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

nav button {
  padding: 10px 15px;
  background: var(--accent-color);
  border: none;
  color: var(--text-light);
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.3s ease;
  font-size: 14px;
}

nav button:hover {
  background: var(--secondary-bg);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* ===== PAGES ===== */
.page {
  padding: 30px 20px;
  min-height: 50vh;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ===== GAMES GRID ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 25px;
  margin-top: 30px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
}

.card {
  background: var(--primary-bg);
  border: 2px solid var(--border-color);
  padding: 25px;
  border-radius: 12px;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card:hover {
  background: var(--secondary-bg);
  border-color: var(--accent-color);
  transform: scale(1.08) translateY(-8px);
  box-shadow: 0 12px 24px rgba(102, 126, 234, 0.4);
}

.card h3 {
  margin: 0 0 15px 0;
  color: var(--text-light);
  font-size: 18px;
}

.card a {
  display: inline-block;
  margin-top: 15px;
  padding: 12px 25px;
  background: var(--accent-color);
  color: var(--text-light);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.3s ease;
  font-weight: bold;
}

.card a:hover {
  background: var(--secondary-bg);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ===== AI CHAT ===== */
.chat-box {
  max-width: 700px;
  margin: 0 auto;
  background: var(--primary-bg);
  border-radius: 12px;
  border: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 500px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  padding: 12px 16px;
  border-radius: 8px;
  max-width: 80%;
  word-wrap: break-word;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.user {
  align-self: flex-end;
  background: var(--accent-color);
  color: var(--text-light);
  border-bottom-right-radius: 0;
}

.chat-message.bot {
  align-self: flex-start;
  background: var(--secondary-bg);
  color: var(--text-light);
  border-bottom-left-radius: 0;
}

.chat-input {
  display: flex;
  padding: 15px;
  gap: 10px;
  border-top: 2px solid var(--border-color);
}

.chat-input input {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--secondary-bg);
  color: var(--text-light);
  font-size: 14px;
}

.chat-input button {
  padding: 12px 25px;
  background: var(--accent-color);
  color: var(--text-light);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.chat-input button:hover {
  background: var(--secondary-bg);
  transform: scale(1.05);
}

/* ===== SETTINGS ===== */
.settings-container {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.setting {
  background: var(--primary-bg);
  padding: 20px;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  transition: all 0.3s ease;
}

.setting:hover {
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.setting h3 {
  margin-top: 0;
  color: var(--text-light);
  font-size: 18px;
}

.setting select,
.setting button {
  width: 100%;
  padding: 12px;
  background: var(--secondary-bg);
  color: var(--text-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.setting button:hover {
  background: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.panic-btn {
  background: linear-gradient(135deg, #ff0000, #ff6b6b) !important;
  font-weight: bold;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
  }
}

.panic-btn:hover {
  transform: scale(1.05) !important;
}

/* ===== BROWSER ===== */
#browserPage {
  display: flex !important;
  flex-direction: column;
  height: 100vh;
}

.browser-header {
  background: var(--secondary-bg);
  padding: 15px;
  text-align: center;
  color: var(--text-light);
  font-size: 24px;
  font-weight: bold;
  border-bottom: 2px solid var(--border-color);
  order: 1;
}

.browser-buttons {
  background: var(--secondary-bg);
  padding: 15px;
  text-align: center;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  order: 2;
}

.browser-input {
  background: var(--secondary-bg);
  padding: 15px;
  text-align: center;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  order: 3;
}

#fakeBrowserWindow {
  flex: 1;
  background: var(--primary-bg);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 2px solid var(--border-color);
  order: 4;
}

.browser-buttons button,
.browser-input button {
  padding: 10px 20px;
  background: var(--accent-color);
  color: var(--text-light);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.browser-buttons button:hover,
.browser-input button:hover {
  background: var(--primary-bg);
  transform: translateY(-2px);
}

#browserUrl {
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--primary-bg);
  color: var(--text-light);
  font-size: 14px;
}

/* ===== UPDATE POPUP ===== */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.popup-content {
  background: var(--secondary-bg);
  padding: 40px;
  border-radius: 15px;
  max-width: 500px;
  text-align: center;
  color: var(--text-light);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.popup-content h2 {
  margin-top: 0;
  color: var(--text-light);
}

.popup-content ul {
  text-align: left;
  list-style-position: inside;
  line-height: 2;
}

.popup-content button {
  margin-top: 20px;
  padding: 12px 30px;
  background: var(--accent-color);
  color: var(--text-light);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.popup-content button:hover {
  background: var(--primary-bg);
  transform: scale(1.05);
}

.close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.3s ease;
}

.close:hover {
  transform: rotate(90deg);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
  }

  .card {
    padding: 15px;
  }

  header {
    flex-direction: column;
    gap: 10px;
  }

  nav {
    flex-direction: column;
  }

  nav button {
    width: 100%;
  }

  .popup-content {
    margin: 20px;
    max-width: calc(100% - 40px);
  }

  .chat-box {
    height: 400px;
  }
}