/* Font Face Declarations */
@font-face {
  font-family: 'PingAR+LT';
  src: url('./fonts/PingAR+LT-Hairline_1756061957673.otf') format('opentype');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PingAR+LT';
  src: url('./fonts/PingAR+LT-Thin_1756061957674.otf') format('opentype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PingAR+LT';
  src: url('./fonts/PingAR+LT-ExtraLight_1756061957674.otf') format('opentype');
  font-weight: 250;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PingAR+LT';
  src: url('./fonts/PingAR+LT-Light_1756061957675.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PingAR+LT';
  src: url('./fonts/PingAR+LT-Regular_1756061957676.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PingAR+LT';
  src: url('./fonts/PingAR+LT-Medium_1756061957675.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PingAR+LT';
  src: url('./fonts/PingAR+LT-Bold_1756061957675.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PingAR+LT';
  src: url('./fonts/PingAR+LT-Heavy_1756061957676.otf') format('opentype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PingAR+LT';
  src: url('./fonts/PingAR+LT-Black_1756061957674.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Enhanced Atmaal Brand Colors */
  --atmaal-primary: #93D500;     /* Primary Green */
  --atmaal-primary-light: #A8E335; /* Lighter Primary */
  --atmaal-primary-dark: #7AB800;  /* Darker Primary */
  --atmaal-secondary: #87E1D1;     /* Teal */
  --atmaal-secondary-light: #9EE8D8; /* Lighter Teal */
  --atmaal-accent: #006A5B;        /* Dark Green Accent */
  --atmaal-accent-light: #00856B;  /* Lighter Dark Green */
  --atmaal-gray: #B1B1B1;          /* Cool Gray */
  --atmaal-light-gray: #F5F5F5;    /* Very Light Gray */
  --atmaal-black: #1A1A1A;         /* Soft Black */
  --atmaal-white: #FFFFFF;         /* Pure White */
  
  /* Saudi National Colors */
  --saudi-green: #006C35;
  --saudi-white: #FFFFFF;
  --gold-accent: #FFD700;
  --bronze-accent: #CD7F32;
  
  /* Theme Colors */
  --primary: var(--atmaal-primary);
  --primary-light: var(--atmaal-primary-light);
  --primary-dark: var(--atmaal-primary-dark);
  --secondary: var(--atmaal-secondary);
  --accent: var(--atmaal-accent);
  
  /* Background & Surface */
  --background: linear-gradient(135deg, #F8FFFE 0%, #F0FDF4 50%, #ECFDF5 100%);
  --surface: var(--atmaal-white);
  --surface-light: #FAFBFA;
  --surface-elevated: rgba(255, 255, 255, 0.95);
  
  /* Text Colors */
  --text-primary: var(--atmaal-black);
  --text-secondary: #4A4A4A;
  --text-muted: #6B7280;
  --text-on-primary: var(--atmaal-white);
  
  /* Interactive States */
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --border-focus: var(--primary);
  --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-large: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-primary: 0 4px 14px rgba(147, 213, 0, 0.25);
  
  /* Status Colors */
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --info: #3B82F6;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'PingAR+LT', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Enhanced Header */
.header {
  position: relative;
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--text-on-primary);
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M30 30c0-11.046-8.954-20-20-20s-20 8.954-20 20 8.954 20 20 20 20-8.954 20-20z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  animation: float 20s infinite linear;
  z-index: 1;
}

@keyframes float {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  position: relative;
  z-index: 2;
}

.header-logo {
  width: 80px;
  height: 80px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
  transition: transform 0.3s ease;
}

.header-logo:hover {
  transform: scale(1.05);
}

.header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin: 0;
  position: relative;
  z-index: 2;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 500;
  margin: 10px 0 5px;
  position: relative;
  z-index: 2;
  opacity: 0.95;
}

.subtitle-en {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 400;
  opacity: 0.8;
  position: relative;
  z-index: 2;
}

/* Enhanced Main Content */
.main-content {
  display: grid;
  gap: 40px;
  padding: 40px 0;
}

.section {
  width: 100%;
}

/* Enhanced Cards */
.card {
  background: var(--surface);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-large);
}

.card h2 {
  color: var(--primary);
  margin-bottom: 30px;
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.card h2::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 2px;
}

.card h3 {
  color: var(--secondary);
  margin-bottom: 20px;
  font-size: 1.4rem;
  font-weight: 600;
}

/* Enhanced Forms */
.form-group {
  margin-bottom: 24px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--surface-light);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(147, 213, 0, 0.1);
  background: var(--surface);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* Enhanced Example Prompts */
.example-prompts {
  margin-top: 16px;
  padding: 20px;
  background: var(--surface-light);
  border-radius: 16px;
  border: 1px solid var(--border-light);
}

.example-prompts p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.prompt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.prompt-suggestion {
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--text-on-primary);
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-light);
}

.prompt-suggestion:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary);
}

/* Enhanced Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 32px;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--text-on-primary);
  box-shadow: var(--shadow-medium);
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-light);
}

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

.btn-small {
  padding: 12px 20px;
  font-size: 14px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: var(--shadow-light);
}

/* Enhanced Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid transparent;
  border-top: 3px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Enhanced Image Preview */
.image-preview {
  text-align: center;
  margin-bottom: 30px;
}

.image-preview canvas {
  max-width: 100%;
  height: auto;
  border-radius: 20px;
  box-shadow: var(--shadow-large);
  border: 4px solid var(--surface);
  transition: transform 0.3s ease;
}

.image-preview canvas:hover {
  transform: scale(1.02);
}

.image-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

/* Enhanced Contest CTA */
.contest-cta {
  background: linear-gradient(135deg, var(--gold-accent) 0%, var(--bronze-accent) 100%);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow-medium);
  position: relative;
  overflow: hidden;
}

.contest-cta::before {
  content: '✨';
  position: absolute;
  top: -10px;
  right: 20px;
  font-size: 3rem;
  opacity: 0.3;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.3; }
  50% { transform: scale(1.1) rotate(10deg); opacity: 0.6; }
}

.cta-content h4 {
  color: var(--atmaal-black);
  margin-bottom: 12px;
  font-size: 1.4rem;
  font-weight: 700;
}

.cta-content p {
  color: var(--atmaal-black);
  margin: 0;
  font-weight: 500;
  line-height: 1.5;
}

/* Enhanced Gallery */
.gallery-section h2 {
  text-align: center;
  direction: rtl;
  margin-bottom: 8px;
  color: var(--primary);
}

.gallery-section h3 {
  text-align: center;
  font-weight: 400;
  margin-bottom: 30px;
  color: var(--text-secondary);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.gallery-placeholder {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--surface-light) 0%, var(--border-light) 100%);
  border: 2px dashed var(--border);
  border-radius: 20px;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

.gallery-item {
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-light);
  transition: all 0.3s ease;
  position: relative;
}

.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-large);
  border-color: var(--primary);
}

.gallery-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.gallery-item:hover::before {
  transform: scaleX(1);
}

.gallery-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-image {
  transform: scale(1.05);
}

.gallery-info {
  padding: 20px;
}

.gallery-prompt {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-creator {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-creator::before {
  content: '👤';
  font-size: 12px;
}

.gallery-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.gallery-date {
  font-size: 12px;
  color: var(--text-muted);
}

.gallery-model {
  font-size: 11px;
  background: var(--secondary);
  color: var(--text-on-primary);
  padding: 4px 8px;
  border-radius: 8px;
  font-weight: 500;
}

/* Enhanced Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.modal-content {
  background: var(--surface);
  border-radius: 24px;
  max-width: 650px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-light);
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 40px;
  text-align: center;
  color: var(--text-on-primary);
  position: relative;
  overflow: hidden;
}

.modal-header::before {
  content: '🇸🇦';
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 2rem;
  opacity: 0.3;
}

.modal-logo {
  width: 90px;
  height: auto;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.modal-header h2 {
  color: var(--text-on-primary);
  font-weight: 700;
  font-size: 1.8rem;
  margin: 0;
}

.modal-body {
  padding: 40px;
  text-align: center;
}

.welcome-text-ar {
  font-size: 1.2rem;
  line-height: 1.8;
  margin-bottom: 24px;
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
}

.celebration-features {
  display: grid;
  gap: 20px;
  margin: 30px 0;
  padding: 24px;
  background: var(--surface-light);
  border-radius: 16px;
  border: 1px solid var(--border-light);
}

.feature {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: 12px;
  direction: rtl;
  box-shadow: var(--shadow-light);
  transition: transform 0.3s ease;
}

.feature:hover {
  transform: translateX(-4px);
}

.feature-icon {
  font-size: 2rem;
  min-width: 50px;
  text-align: center;
}

.contest-instruction {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--primary);
  background: var(--surface-light);
  padding: 24px;
  border-radius: 16px;
  border: 2px solid var(--primary);
  direction: rtl;
  text-align: right;
  margin: 24px 0;
}

.modal-footer {
  padding: 30px 40px;
  text-align: center;
  background: var(--surface-light);
  border-top: 1px solid var(--border-light);
}

/* Enhanced Banners */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--error);
  color: var(--text-on-primary);
  text-align: center;
  padding: 12px;
  z-index: 1000;
  box-shadow: var(--shadow-medium);
  font-weight: 500;
}

.install-banner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--text-on-primary);
  padding: 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-large);
  z-index: 1000;
}

.install-banner p {
  margin: 0;
  font-weight: 500;
}

.btn-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--text-on-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.3s ease;
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.loading-shimmer {
  background: linear-gradient(90deg, var(--surface-light) 25%, var(--border-light) 50%, var(--surface-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Enhanced Statistics */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.stat-card {
  background: var(--surface);
  padding: 24px;
  border-radius: 16px;
  text-align: center;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-light);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* Filter Controls */
.filter-controls {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-btn {
  padding: 10px 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.filter-btn.active,
.filter-btn:hover {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--text-on-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .header {
    padding: 40px 16px;
  }
  
  .logo-container {
    flex-direction: column;
    gap: 16px;
  }
  
  .card {
    padding: 24px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .image-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .image-actions .btn {
    width: 100%;
  }
  
  .install-banner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .filter-controls {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 30px 16px;
  }
  
  .card {
    padding: 20px;
  }
  
  .btn {
    padding: 14px 24px;
    font-size: 15px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 24px;
  }
}

/* Print Styles */
@media print {
  .header,
  .install-banner,
  .offline-banner,
  .btn {
    display: none !important;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  body {
    background: white;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .gallery-image {
    filter: brightness(0.9);
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Styles for Keyboard Navigation */
.btn:focus-visible,
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}