/* ============================================
   Riadah Games - Main Stylesheet
   ============================================ */

/* CSS Variables */
:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #f59e0b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;

  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-dark: #1e293b;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --text-white: #ffffff;

  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  --transition: all 0.2s ease-in-out;

  --font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--text-white);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
}

.btn-secondary {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--primary-color);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: var(--text-white);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
  color: var(--text-white);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Header */
.main-header {
  background-color: var(--bg-primary);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.main-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin: 0;
}

.main-nav {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  right: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--primary-color);
}

.nav-link:hover::after {
  width: 100%;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--text-white);
  padding: 6rem 0;
  text-align: center;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

.hero-description {
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  opacity: 0.95;
  color: rgba(255, 255, 255, 0.9);
}

/* Games Section */
.games-section {
  padding: 5rem 0;
}

.section-title {
  text-align: center;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 3rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.game-card {
  background-color: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-light);
}

.game-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.game-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.game-description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.game-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

.btn-play {
  width: 100%;
}

/* Leaderboard Section */
.leaderboard-section {
  padding: 5rem 0;
  background-color: var(--bg-primary);
}

.leaderboard-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover {
  background-color: var(--bg-primary);
  border-color: var(--primary-light);
  color: var(--primary-color);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-color: var(--primary-color);
  color: var(--text-white);
}

.leaderboard-table-container {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th {
  background-color: var(--bg-dark);
  color: var(--text-white);
  font-weight: 600;
  padding: 1rem;
  text-align: right;
}

.leaderboard-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr:hover td {
  background-color: var(--bg-primary);
}

.rank-1 td { background-color: rgba(251, 191, 36, 0.1); }
.rank-2 td { background-color: rgba(148, 163, 184, 0.1); }
.rank-3 td { background-color: rgba(180, 83, 9, 0.1); }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.875rem;
}

.rank-1 .rank-badge { background-color: #fbbf24; color: #92400e; }
.rank-2 .rank-badge { background-color: #94a3b8; color: #334155; }
.rank-3 .rank-badge { background-color: #b45309; color: #fef3c7; }
.rank-badge:not(.rank-1):not(.rank-2):not(.rank-3) {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
}

.score-cell {
  font-weight: 700;
  color: var(--primary-color);
}

.loading-cell {
  text-align: center;
  color: var(--text-light);
  padding: 2rem;
}

.empty-cell {
  text-align: center;
  color: var(--text-light);
  padding: 2rem;
}

/* About Section */
.about-section {
  padding: 5rem 0;
  background-color: var(--bg-secondary);
}

.about-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 4rem;
  align-items: center;
}

.about-text p {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.stat-item {
  text-align: center;
  padding: 1.5rem;
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Footer */
.main-footer {
  background-color: var(--bg-dark);
  color: var(--text-light);
  padding: 2rem 0;
  text-align: center;
}

.copyright {
  font-size: 0.9375rem;
  margin: 0;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background-color: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--bg-secondary);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-close:hover {
  background-color: var(--danger-color);
  color: var(--text-white);
}

#game-container {
  padding: 2rem;
}

/* Game Container Styles */
.game-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.game-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

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

.game-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background-color: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 60px;
  text-align: left;
}

/* Question/Scenario Cards */
.card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.card-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* Options/Answers */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.option-item:hover {
  border-color: var(--primary-light);
  background-color: rgba(99, 102, 241, 0.05);
}

.option-item.selected {
  border-color: var(--primary-color);
  background-color: rgba(99, 102, 241, 0.1);
}

.option-item.correct {
  border-color: var(--success-color);
  background-color: rgba(16, 185, 129, 0.1);
}

.option-item.incorrect {
  border-color: var(--danger-color);
  background-color: rgba(239, 68, 68, 0.1);
}

.option-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.option-item.selected .option-radio {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
}

.option-item.selected .option-radio::after {
  content: '';
  width: 8px;
  height: 8px;
  background-color: white;
  border-radius: 50%;
}

.option-text {
  flex: 1;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Results */
.results-container {
  text-align: center;
  padding: 2rem;
}

.score-display {
  margin-bottom: 2rem;
}

.score-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow-lg);
}

.score-value {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}

.score-label {
  font-size: 0.875rem;
  opacity: 0.9;
}

.score-message {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.results-details {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
  text-align: right;
}

.results-details h4 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.result-stat {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.result-stat:last-child {
  border-bottom: none;
}

.result-stat-label {
  color: var(--text-secondary);
}

.result-stat-value {
  font-weight: 700;
  color: var(--text-primary);
}

.result-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Name Input */
.name-input-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 2rem;
  text-align: center;
}

.name-input-container h3 {
  margin-bottom: 1rem;
}

.name-input-container p {
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.name-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-family);
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  transition: var(--transition);
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .main-header .container {
    flex-direction: column;
    gap: 1rem;
  }

  .main-nav {
    gap: 1rem;
  }

  .hero {
    padding: 4rem 0;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-tabs {
    flex-direction: column;
    align-items: center;
  }

  .leaderboard-table {
    font-size: 0.875rem;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 0.75rem 0.5rem;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about-stats {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  #game-container {
    padding: 1rem;
  }

  .game-title {
    font-size: 1.5rem;
  }

  .options-list {
    gap: 0.5rem;
  }

  .option-item {
    padding: 0.75rem;
  }

  .result-actions {
    flex-direction: column;
  }

  .score-circle {
    width: 120px;
    height: 120px;
  }

  .score-value {
    font-size: 2.5rem;
  }
}

/* Tabs Navigation */
.main-content {
  padding: 4rem 0;
  background-color: var(--bg-secondary);
}

.tabs-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) var(--bg-secondary);
}

.tabs-nav::-webkit-scrollbar {
  height: 4px;
}

.tabs-nav::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 2px;
}

.tabs-nav::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 2px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background-color: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

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

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-color: var(--primary-color);
  color: var(--text-white);
  box-shadow: var(--shadow-lg);
}

.tab-icon {
  font-size: 1.25rem;
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Game Intro Card */
.game-intro {
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  border-radius: var(--radius-xl);
  padding: 3rem;
  text-align: center;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.tab-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.tab-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.game-meta {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background-color: var(--bg-primary);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-start {
  min-width: 200px;
}

/* Leaderboard Container */
.leaderboard-container {
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  border-radius: var(--radius-xl);
  padding: 2rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.leaderboard-container .tab-title {
  text-align: center;
}

.leaderboard-container .tab-description {
  text-align: center;
  margin-bottom: 2rem;
}

/* Leaderboard Game Tabs */
.leaderboard-game-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.lb-tab-btn {
  padding: 0.625rem 1.25rem;
  background-color: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-family);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.lb-tab-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary-color);
}

.lb-tab-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-color: var(--primary-color);
  color: var(--text-white);
}

/* Responsive for tabs */
@media (max-width: 768px) {
  .tab-btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .tab-icon {
    font-size: 1rem;
  }

  .game-intro {
    padding: 2rem 1.5rem;
  }

  .tab-title {
    font-size: 1.5rem;
  }

  .tab-description {
    font-size: 1rem;
  }

  .game-meta {
    gap: 1rem;
  }

  .meta-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }

  .leaderboard-game-tabs {
    flex-direction: column;
    align-items: center;
  }

  .lb-tab-btn {
    width: 100%;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.5rem;
  }

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

  .game-card {
    padding: 1.5rem;
  }

  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
  }
}
/* Deployed: 2026-04-28 20:05:36 UTC */
/* Deployed: 2026-04-28 21:26:23 UTC */
