@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  --bg-color: #0f0f12;
  --surface-color: #1a1a20;
  --surface-hover: #26262e;
  --primary-color: #fa5c5c;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --border-color: #2e2e38;
}

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

body {
  font-family: 'Tajawal', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar */
header {
  background-color: rgba(26, 26, 32, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
}

/* Hero Section */
.hero {
  padding: 60px 0;
  text-align: center;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 10px;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Games Grid */
.section-title {
  font-size: 1.8rem;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  background-color: var(--border-color);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  margin-bottom: 60px;
}

.game-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.game-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background-color: #2a2a30;
}

.game-info {
  padding: 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.game-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.game-developer {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 15px;
  flex-grow: 1;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-price {
  background-color: rgba(250, 92, 92, 0.1);
  color: var(--primary-color);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}

.game-platform {
  color: var(--text-secondary);
  font-size: 1.2rem;
}

/* Game Page specifics */
.game-header {
  display: flex;
  gap: 30px;
  margin-top: 40px;
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .game-header {
    flex-direction: column-reverse;
  }
}

.game-header-image {
  flex: 1;
  border-radius: 12px;
  overflow: hidden;
}

.game-header-image img {
  width: 100%;
  height: auto;
  display: block;
}

.game-header-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.game-header-details h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.game-header-details .developer {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.game-header-details .description {
  margin-bottom: 30px;
  line-height: 1.8;
  color: #d1d1d6;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary-color);
  color: white;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  width: fit-content;
  gap: 10px;
}

.btn-download:hover {
  background-color: #ff3b3b;
  transform: scale(1.05);
}

.download-section {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 40px;
}

.download-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-color);
}

.download-item:last-child {
  border-bottom: none;
}

.download-info h3 {
  margin-bottom: 5px;
}

.download-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.9rem;
}

/* About Section */
.about-section {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px;
  margin-bottom: 60px;
  text-align: center;
}

.about-section h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 2rem;
}

.about-section p {
  color: #d1d1d6;
  font-size: 1.1rem;
  max-width: 800px;
  margin: 0 auto 20px auto;
  line-height: 1.8;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--surface-hover);
  border-radius: 50%;
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.social-links a:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Gallery / Media Section for Games */
.media-gallery {
  margin-top: 30px;
  margin-bottom: 50px;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 ratio */
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  margin-bottom: 20px;
  background-color: #000;
  border: 1px solid var(--border-color);
}

.video-container iframe, .video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

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

.screenshot {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.3s ease, border-color 0.3s ease;
  border: 1px solid var(--border-color);
}

.screenshot:hover {
  transform: scale(1.05);
  border-color: var(--primary-color);
}

/* Search Bar */
.search-form {
  display: flex;
  align-items: center;
  background-color: var(--surface-color);
  border-radius: 20px;
  padding: 5px 15px;
  border: 1px solid var(--border-color);
  transition: border-color 0.3s;
}

.search-form:focus-within {
  border-color: var(--primary-color);
}

.search-form input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  padding: 5px;
  width: 250px;
}

.search-form button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.3s;
  padding: 5px;
}

.search-form button:hover {
  color: var(--primary-color);
}

@media (max-width: 768px) {
  .search-form input {
    width: 150px;
  }
}

/* Chat & Auth UI */
.setup-container, .chat-auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.auth-box {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 450px;
  text-align: center;
}

.auth-icon {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.auth-box h2 {
  margin-bottom: 10px;
}

.auth-box p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 30px;
  line-height: 1.5;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

#auth-form input {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 15px;
  border-radius: 8px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
}

#auth-form input:focus {
  border-color: var(--primary-color);
}

#auth-form button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.3s;
  margin-top: 10px;
}

#auth-form button:hover {
  background-color: #ff3b3b;
}

.auth-switch {
  margin-top: 20px;
}

.auth-switch a {
  color: var(--primary-color);
  font-weight: bold;
}

.auth-error {
  color: #ff3b3b;
  margin-top: 15px;
  font-size: 0.9rem;
}

/* Chat Layout */
.chat-container {
  display: flex;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  height: 70vh;
  margin-top: 30px;
  overflow: hidden;
}

.chat-sidebar {
  width: 250px;
  background-color: var(--surface-hover);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.chat-sidebar h3 {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 1.1rem;
}

.room-list {
  list-style: none;
  flex-grow: 1;
}

.room-list li {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.room-list li.active, .room-list li:hover {
  background-color: rgba(250, 92, 92, 0.1);
  color: var(--primary-color);
  font-weight: bold;
}

.user-profile {
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-color);
}

#logout-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
  font-size: 1.2rem;
}

#logout-btn:hover {
  color: var(--primary-color);
}

.chat-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
}

.chat-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.message {
  max-width: 70%;
  padding: 10px 15px;
  border-radius: 12px;
  position: relative;
}

.my-message {
  align-self: flex-start;
  background-color: var(--primary-color);
  color: white;
  border-top-right-radius: 0;
}

.other-message {
  align-self: flex-end;
  background-color: var(--surface-hover);
  color: var(--text-primary);
  border-top-left-radius: 0;
}

.msg-sender {
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  opacity: 0.8;
}

.msg-time {
  font-size: 0.7rem;
  font-weight: normal;
  margin-right: 10px;
}

.msg-content {
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-input-area {
  display: flex;
  padding: 15px;
  background-color: var(--surface-color);
  border-top: 1px solid var(--border-color);
}

.chat-input-area input {
  flex-grow: 1;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 15px;
  border-radius: 20px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
}

.chat-input-area input:focus {
  border-color: var(--primary-color);
}

.chat-input-area button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-right: 10px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.1rem;
  transition: transform 0.2s, background-color 0.2s;
}

.chat-input-area button:hover {
  background-color: #ff3b3b;
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .chat-container {
    flex-direction: column;
    height: 80vh;
  }
  .chat-sidebar {
    width: 100%;
    border-left: none;
    border-bottom: 1px solid var(--border-color);
    flex-direction: row;
    align-items: center;
  }
  .chat-sidebar h3 {
    border-bottom: none;
    padding: 10px;
  }
  .room-list {
    display: flex;
    margin-right: auto;
  }
  .room-list li {
    border-bottom: none;
    padding: 10px;
  }
}
