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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

/* Arabic Font Support */
.font-arabic {
  font-family: "SF Arabic", "Segoe UI Arabic", "Tahoma", "Arial Unicode MS", sans-serif;
  font-feature_settings: "liga" 1, "kern" 1;
}

/* Tifinagh Font Support */
.font-tifinagh {
  font-family: "Ebrima", "Noto Sans Tifinagh", "Tifinagh", "Arial Unicode MS", sans-serif;
  font-feature_settings: "liga" 1, "kern" 1;
  line-height: 1.6;
}

/* RTL Support */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .container {
  direction: rtl;
}

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

/* Header */
.header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 1rem 0;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  height: 48px;
  width: auto;
}

.brand-text {
  font-size: 1.25rem;
  font-weight: bold;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav a {
  text-decoration: none;
  color: #374151;
  font-weight: 500;
  transition: color 0.2s;
}

.nav a:hover {
  color: #dc2626;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  text-decoration: none;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background-color: #dc2626;
  color: white;
}

.btn-primary:hover {
  background-color: #b91c1c;
}

.btn-secondary {
  background-color: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background-color: #4b5563;
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1.125rem;
}

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

.btn-full {
  width: 100%;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  padding: 5rem 0;
  text-align: center;
}

.hero-title {
  font-size: 3rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Categories Section */
.categories {
  padding: 4rem 0;
  background: white;
}

.section-title {
  font-size: 2rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 3rem;
}

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

.category-card {
  background: #f9fafb;
  padding: 1.5rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.category-card h3 {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.category-card ul {
  list-style: none;
  margin-bottom: 1rem;
}

.category-card li {
  padding: 0.25rem 0;
}

.fee {
  font-weight: 600;
  color: #dc2626;
}

/* Auth Pages */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 600px;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header .logo {
  height: 80px;
  margin-bottom: 1rem;
}

.auth-header h1 {
  font-size: 1.875rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.auth-header p {
  color: #6b7280;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Registration Code Input Group */
.code-input-group {
  display: flex;
  gap: 0.5rem;
}

.code-input-group input {
  flex: 1;
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.validation-message {
  margin-top: 0.5rem;
}

.info-card {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.375rem;
  padding: 1rem;
  margin: 1rem 0;
}

.info-card h3 {
  margin-bottom: 0.5rem;
  color: #0369a1;
}

.info-card p {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
}

.info {
  background-color: #eff6ff;
  color: #1d4ed8;
  padding: 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid #bfdbfe;
}

/* Dashboard */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background: white;
  border-right: 1px solid #e5e7eb;
  padding: 1rem;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.sidebar-header .logo {
  height: 40px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-nav a {
  padding: 0.75rem;
  text-decoration: none;
  color: #374151;
  border-radius: 0.375rem;
  transition: background-color 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background-color: #fef2f2;
  color: #dc2626;
}

.main-content {
  flex: 1;
  padding: 2rem;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  font-size: 2rem;
  font-weight: bold;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.export-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

.stat-card h3 {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: #dc2626;
}

/* Tables */
.participants-section {
  background: white;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.participants-section h2 {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  margin: 0;
}

.participants-table {
  overflow-x: auto;
}

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

th,
td {
  padding: 0.75rem 1.5rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background-color: #f9fafb;
  font-weight: 600;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 0.5rem;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
  margin: 0;
}

.close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
}

.participant-form {
  padding: 1.5rem;
}

.categories-section {
  margin: 1.5rem 0;
}

.categories-section h3 {
  margin-bottom: 1rem;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.5rem;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  cursor: pointer;
}

.category-item.mandatory {
  background-color: #fef2f2;
  border-color: #fecaca;
}

.fee-display {
  margin: 1.5rem 0;
  padding: 1rem;
  background-color: #f9fafb;
  border-radius: 0.375rem;
  text-align: center;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Language Switcher */
.language-switcher select {
  padding: 0.25rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: white;
}

/* Messages */
.error {
  background-color: #fef2f2;
  color: #dc2626;
  padding: 0.75rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  border: 1px solid #fecaca;
}

.success {
  background-color: #f0fdf4;
  color: #16a34a;
  padding: 0.75rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
  border: 1px solid #bbf7d0;
}

/* Footer */
.footer {
  background: #1f2937;
  color: white;
  padding: 3rem 0;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

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

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .dashboard {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

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

  .nav {
    flex-direction: column;
    gap: 0.5rem;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .header-actions {
    flex-direction: column;
    width: 100%;
  }

  .export-buttons {
    width: 100%;
    justify-content: center;
  }

  .code-input-group {
    flex-direction: column;
  }
}

/* RTL Specific Adjustments */
[dir="rtl"] th,
[dir="rtl"] td {
  text-align: right;
}

[dir="rtl"] .nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .hero-buttons {
  flex-direction: row-reverse;
}

[dir="rtl"] .dashboard-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .form-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .header-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .export-buttons {
  flex-direction: row-reverse;
}

[dir="rtl"] .code-input-group {
  flex-direction: row-reverse;
}

/* Add these styles to the end of the CSS file */

/* Rules Page Styles */
.rules-section {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.rules-section:last-child {
  border-bottom: none;
}

.rules-section h3 {
  color: #dc2626;
  margin-bottom: 1rem;
}

.rules-section h4 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.rules-section ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.rules-section ul li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.subtitle {
  color: #6b7280;
  margin-top: 0.5rem;
}

.gumbub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

.gumbub-item {
  padding: 1.5rem;
  border-radius: 0.5rem;
  text-align: center;
  color: white;
  font-weight: bold;
}

.gumbub-item h4 {
  margin: 0;
  font-size: 1.1rem;
}

.gumbub-1 {
  background-color: #ef4444; /* Red */
}

.gumbub-2 {
  background-color: #f97316; /* Orange */
}

.gumbub-3 {
  background-color: #eab308; /* Yellow */
}

.gumbub-4 {
  background-color: #84cc16; /* Lime */
}

.gumbub-5 {
  background-color: #10b981; /* Emerald */
}

.gumbub-6 {
  background-color: #06b6d4; /* Cyan */
}

.gumbub-7 {
  background-color: #3b82f6; /* Blue */
}

.gumbub-8 {
  background-color: #8b5cf6; /* Violet */
}

.gumbub-9 {
  background-color: #d946ef; /* Fuchsia */
}

/* Responsive adjustments for the gumbub grid */
@media (max-width: 768px) {
  .gumbub-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .gumbub-grid {
    grid-template-columns: 1fr;
  }
}

/* RTL adjustments for rules page */
[dir="rtl"] .rules-section ul {
  padding-right: 1.5rem;
  padding-left: 0;
}

/* Tifinagh adjustments */
[lang="zgh"] .rules-section h3 {
  line-height: 1.6;
}

[lang="zgh"] .gumbub-item h4 {
  line-height: 1.6;
}
