/* ========== Modern Glassmorphism Theme ========== */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Core Colors */
  /* Core Colors */
  --primary: #16a34a;
  /* Green-600 */
  --primary-dark: #15803d;
  /* Green-700 */
  --primary-light: #4ade80;
  /* Green-400 */
  --primary-gradient: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  --secondary: #eab308;
  /* Yellow-500 for accents/gold */
  --accent: #f472b6;

  /* Animations */
  --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-short: 200ms;
}

[data-theme="dark"] {
  /* Dark Mode - Deep Space */
  /* Dark Mode - Deep Space */
  --bg-color: #020617;
  --bg-gradient: radial-gradient(circle at 15% 50%, rgba(22, 163, 74, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(234, 179, 8, 0.08), transparent 25%);

  /* Glass Surfaces */
  --glass-surface: rgba(15, 23, 42, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.03);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);

  /* Text */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-on-primary: #0f172a;

  /* Status */
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
}

[data-theme="light"] {
  /* Light Mode - Clean Air */
  /* Light Mode - Clean Air */
  --bg-color: #f8fafc;
  --bg-gradient: radial-gradient(circle at 15% 50%, rgba(22, 163, 74, 0.05), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(234, 179, 8, 0.05), transparent 25%);

  /* Glass Surfaces */
  --glass-surface: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-highlight: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

  /* Text */
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-on-primary: #ffffff;

  /* Status */
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

/* ========== Base Reset ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 16px;
  transition: background-color 0.5s ease, color 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-short) ease;
}

a:hover {
  color: var(--primary);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== Typography ========== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.h3 {
  font-size: 1.25rem;
}

/* Helper */

/* ========== Animations ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main>* {
  animation: fadeIn 0.6s var(--ease-smooth) forwards;
}

/* ========== Header ========== */
.site-header {
  position: sticky;
  top: 16px;
  z-index: 100;
  margin: 0 16px;
  border-radius: 20px;
  background: var(--glass-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  padding: 0 24px;
}

.brand {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav a {
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.nav a:hover,
.nav a.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ========== Hero ========== */
.hero {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  padding: 80px 24px 120px;
  /* Extra padding bottom for the overlapping card */
  margin-bottom: 24px;
  border-radius: 0 0 40px 40px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #16a34a;
  background-image: url('https://placehold.co/1920x800/16a34a/ffffff?text=Village+Hero+Image');
  background-size: cover;
  background-position: center;
  z-index: 1;
}

.hero-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  /* Overlay for text readability */
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  max-width: 800px;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 16px;
  color: white;
  background: none;
  -webkit-text-fill-color: initial;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hero p {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto 32px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* ========== Competition Banner ========== */
.competition-banner {
  position: relative;
  z-index: 10;
  margin-top: -80px;
  /* Pull up to overlap hero */
  margin-bottom: 60px;
  background: var(--glass-surface);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--glass-border);
}

.trophy-icon {
  font-size: 3rem;
  color: var(--secondary);
  background: rgba(234, 179, 8, 0.1);
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.comp-content {
  flex: 1;
  text-align: right;
}

.comp-content h3 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--text-main);
}

.comp-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ========== News Grid ========== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 60px;
}

.news-card {
  background: var(--glass-surface);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.news-card:hover {
  transform: translateY(-5px);
}

.news-img {
  height: 200px;
  background-color: #e5e7eb;
  position: relative;
}

.news-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-tag {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.news-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.news-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}

.news-excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.6;
  flex: 1;
}

.news-link {
  color: var(--primary);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ========== Featured Story ========== */
.story-section {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 80px;
  background: var(--glass-surface);
  border-radius: 30px;
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.story-content {
  padding: 40px;
}

.story-tag {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 12px;
  display: block;
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}

.story-title {
  font-size: 2rem;
  margin-bottom: 16px;
}

.story-desc {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

.story-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #ccc;
}

.story-image {
  height: 100%;
  min-height: 400px;
  position: relative;
}

.story-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 900px) {
  .story-section {
    grid-template-columns: 1fr;
  }

  .competition-banner {
    flex-direction: column;
    text-align: center;
  }

  .comp-content {
    text-align: center;
  }
}

.card {
  background: var(--glass-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-top: 1px solid var(--glass-highlight);
  border-radius: 24px;
  padding: 32px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s var(--ease-elastic), box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  border-color: rgba(45, 212, 191, 0.3);
}

.card h2 {
  font-size: 1.5rem;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}

/* Utility Classes */
.narrow {
  max-width: 500px;
  margin: 40px auto;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 0.85rem;
}

/* Grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: all 0.3s var(--ease-elastic);
  position: relative;
  overflow: hidden;
}

.btn:not(.btn-ghost) {
  background: var(--primary-gradient);
  color: var(--text-on-primary);
  box-shadow: 0 4px 15px rgba(45, 212, 191, 0.3);
}

.btn:not(.btn-ghost):hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(22, 163, 74, 0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

/* ========== Lists ========== */
.list {
  list-style: none;
}

.list li {
  padding: 16px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.list li:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(-4px);
  border-color: var(--primary);
}

/* ========== Gallery ========== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.gallery-item {
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--glass-border);
  margin: 0;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.1);
}

.gallery-item figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: white;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover figcaption {
  opacity: 1;
}

/* ========== Forms ========== */
input,
select,
textarea {
  width: 100%;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

[data-theme="light"] input {
  background: rgba(255, 255, 255, 0.5);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
  background: rgba(0, 0, 0, 0.3);
}

.field {
  display: block;
  margin: 16px 0;
}

.field span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Code Box */
.code-box {
  font-family: monospace;
  font-size: 1.5rem;
  letter-spacing: 2px;
  text-align: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border: 1px dashed var(--primary);
  margin: 20px 0;
  color: var(--text-main);
}

/* Pills */
.pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(45, 212, 191, 0.1);
  color: var(--primary);
}

/* Theme Toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--glass-border);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--warning);
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.pagination a {
  padding: 8px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-muted);
  transition: all 0.2s;
  background: rgba(0, 0, 0, 0.1);
}

.pagination a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--primary);
}

.pagination a.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Footer */
.site-footer {
  margin-top: 80px;
  padding: 40px 0;
  border-top: 1px solid var(--glass-border);
  text-align: center;
  color: var(--text-muted);
}

/* Alerts */
.alert {
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.5rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .site-header {
    margin: 0;
    border-radius: 0;
    border-top: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }
}

/* ========== Filter Tabs ========== */
.filter-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 32px 0;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 20px;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.filter-tab:hover,
.filter-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ========== Leaderboard ========== */
.leaderboard-header {
  text-align: center;
  margin-bottom: 40px;
}

.podium-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 60px;
  min-height: 350px;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 140px;
  position: relative;
}

.podium-item.rank-1 {
  order: 2;
  width: 160px;
  margin-bottom: 40px;
}

.podium-item.rank-2 {
  order: 1;
}

.podium-item.rank-3 {
  order: 3;
}

.podium-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 12px;
  position: relative;
  background-size: cover;
  background-position: center;
}

.rank-1 .podium-avatar {
  width: 120px;
  height: 120px;
  border-color: #fbbf24;
  /* Gold */
}

.rank-2 .podium-avatar {
  border-color: #94a3b8;
  /* Silver */
}

.rank-3 .podium-avatar {
  border-color: #b45309;
  /* Bronze */
}

.crown-icon {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  color: #fbbf24;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.podium-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.podium-score {
  color: var(--primary);
  font-weight: 800;
  font-size: 1.1rem;
}

.podium-rank {
  margin-top: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
}

.rank-1 .podium-rank {
  background: #fbbf24;
  font-size: 1.4rem;
  padding: 24px;
}

.rank-2 .podium-rank {
  background: #94a3b8;
}

.rank-3 .podium-rank {
  background: #b45309;
}

.leaderboard-list {
  max-width: 800px;
  margin: 0 auto 80px;
}

.user-rank-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--glass-surface);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--glass-border);
  padding: 16px 0;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

/* ========== Events ========== */
.events-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.event-featured-card {
  display: flex;
  gap: 24px;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 40px;
}

.event-featured-img {
  width: 40%;
  min-height: 300px;
  background-size: cover;
  background-position: center;
}

.event-featured-content {
  padding: 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.event-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  background: rgba(22, 163, 74, 0.1);
  color: var(--primary);
}

/* ========== Landmarks ========== */
.landmarks-hero {
  height: 400px;
  border-radius: 30px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  margin-bottom: 40px;
  background-size: cover;
  background-position: center;
}

.landmarks-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.6));
}

.landmarks-hero-content {
  position: relative;
  z-index: 2;
}

.landmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.landmark-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 3/4;
  cursor: pointer;
}

.landmark-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.landmark-card:hover img {
  transform: scale(1.1);
}

.landmark-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
  color: white;
}

@media (max-width: 768px) {
  .podium-container {
    align-items: center;
    flex-direction: column;
  }

  .podium-item.rank-1 {
    order: 1;
    margin-bottom: 20px;
  }

  .podium-item.rank-2 {
    order: 2;
  }

  .podium-item.rank-3 {
    order: 3;
  }

  .event-featured-card {
    flex-direction: column;
  }

  .event-featured-img {
    width: 100%;
    height: 200px;
    min-height: auto;
  }
}