/* ==========================================================================
   Al-Naser Private School - ID Portal Design System
   Royal Light Luxury Theme Derived Directly from School Logo
   ========================================================================== */

:root {
  /* Light Theme Color Palette */
  --bg-primary: #f4f7fb;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfdfe;
  --bg-input: #ffffff;
  
  /* Brand Navy & Deep Blues */
  --navy-deep: #061528;
  --navy-main: #0c2340;
  --navy-light: #183863;
  --navy-soft-bg: rgba(12, 35, 64, 0.06);
  --navy-border: #e2e8f0;
  --navy-border-focus: #c59b27;
  
  /* Brand Royal Gold Accents */
  --gold-primary: #c59b27;
  --gold-light: #dfb743;
  --gold-dark: #9e7914;
  --gold-gradient: linear-gradient(135deg, #e5b942 0%, #c59b27 50%, #a47c13 100%);
  --gold-gradient-hover: linear-gradient(135deg, #ebd068 0%, #d4aa33 50%, #b88d19 100%);
  --gold-glow: rgba(197, 155, 39, 0.25);
  --gold-soft-bg: rgba(197, 155, 39, 0.12);

  /* Typography & Text */
  --text-primary: #0f1e33;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-gold: #9e7914;
  
  /* Status & Accents */
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --info: #0284c7;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(12, 35, 64, 0.06);
  --shadow-md: 0 8px 24px rgba(12, 35, 64, 0.08);
  --shadow-lg: 0 20px 45px rgba(12, 35, 64, 0.1), 0 4px 15px rgba(197, 155, 39, 0.08);
  --shadow-gold: 0 8px 25px rgba(197, 155, 39, 0.3);
  
  /* Radii & Transitions */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(197, 155, 39, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(12, 35, 64, 0.05) 0%, transparent 45%),
    radial-gradient(circle at 90% 30%, rgba(197, 155, 39, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

/* English Text Font */
.en-text, input.en-input, span.en-badge {
  font-family: 'Outfit', 'Inter', sans-serif;
  direction: ltr;
  text-align: left;
}

/* Layout Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 1rem;
}

.main-wrapper {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  position: relative;
  z-index: 10;
}

/* Header Section */
.portal-header {
  text-align: center;
  margin-bottom: 2rem;
  animation: fadeInDown 0.6s ease-out;
}

.logo-wrapper {
  display: inline-block;
  position: relative;
  padding: 10px;
  margin-bottom: 0.75rem;
}

.logo-img {
  max-height: 125px;
  width: auto;
  filter: drop-shadow(0 4px 15px rgba(12, 35, 64, 0.12));
  transition: transform var(--transition-smooth);
}

.logo-img:hover {
  transform: scale(1.02);
}

.portal-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--navy-main);
  margin-bottom: 0.35rem;
  letter-spacing: -0.5px;
}

.portal-title .gold-accent {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.portal-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fdf8e6;
  border: 1px solid rgba(197, 155, 39, 0.35);
  color: var(--gold-dark);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}

/* Form Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid rgba(197, 155, 39, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2.25rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-smooth);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--gold-gradient);
}

/* Form Groups */
.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy-main);
}

.form-label-sub {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold-dark);
  font-family: 'Outfit', sans-serif;
  direction: ltr;
}

.required-star {
  color: #dc2626;
  margin-right: 4px;
  font-weight: 800;
}

/* Input Fields */
.form-input, .form-select, .form-textarea {
  width: 100%;
  background-color: var(--bg-input);
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  color: var(--navy-deep);
  font-size: 0.98rem;
  font-family: inherit;
  font-weight: 600;
  transition: all var(--transition-fast);
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 4px rgba(197, 155, 39, 0.15);
  background-color: #ffffff;
}

.form-input::placeholder, .form-textarea::placeholder {
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 400;
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23c59b27' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 1.15rem center;
  padding-left: 2.75rem;
}

.form-select optgroup {
  background-color: #ffffff;
  color: var(--navy-main);
  font-weight: 800;
  font-size: 0.95rem;
}

.form-select option {
  background-color: #ffffff;
  color: var(--text-primary);
  font-weight: 600;
  padding: 8px;
}

/* Custom Specialization Box */
.custom-spec-box {
  display: none;
  background: #fdfbf5;
  border: 1.5px dashed var(--gold-primary);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 0.5rem;
  animation: fadeIn 0.3s ease-in-out;
}

.custom-spec-box.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Photo Upload Zone */
.photo-upload-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.photo-dropzone {
  border: 2px dashed rgba(197, 155, 39, 0.45);
  border-radius: var(--radius-lg);
  background: #fcfaf4;
  padding: 2rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-smooth);
  position: relative;
}

.photo-dropzone:hover, .photo-dropzone.dragover {
  border-color: var(--gold-dark);
  background: #fdf6e2;
  box-shadow: 0 4px 20px rgba(197, 155, 39, 0.15);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.upload-icon-circle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid rgba(197, 155, 39, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-primary);
  font-size: 1.7rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.photo-dropzone:hover .upload-icon-circle {
  transform: translateY(-3px) scale(1.05);
}

.upload-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy-main);
}

.upload-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.upload-limits {
  display: inline-flex;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-dark);
  background: #fff;
  border: 1px solid rgba(197, 155, 39, 0.25);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

/* Live Photo Preview */
.photo-preview-wrapper {
  display: none;
  background: #ffffff;
  border: 1.5px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s ease;
}

.photo-preview-wrapper.active {
  display: flex;
}

.preview-img-container {
  position: relative;
  width: 90px;
  height: 110px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--gold-primary);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  background: #f1f5f9;
}

.preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: hidden;
}

.preview-filename {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--navy-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  text-align: right;
}

.preview-filesize {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-dark);
  font-family: 'Outfit', sans-serif;
  direction: ltr;
  text-align: right;
}

.preview-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.btn-remove-photo {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fca5a5;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-remove-photo:hover {
  background: #fee2e2;
}

.btn-change-photo {
  background: #fdf8e6;
  color: var(--gold-dark);
  border: 1px solid rgba(197, 155, 39, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-change-photo:hover {
  background: #fbf0cb;
}

/* Submit Button */
.submit-btn-wrapper {
  margin-top: 1rem;
}

.btn-primary-gold {
  width: 100%;
  background: var(--gold-gradient);
  color: #0c2340;
  border: none;
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: all var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.btn-primary-gold:hover {
  background: var(--gold-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(197, 155, 39, 0.4);
}

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

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

/* Loading Spinner */
.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(12, 35, 64, 0.25);
  border-top-color: #0c2340;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.btn-primary-gold.loading .spinner {
  display: block;
}

.btn-primary-gold.loading .btn-text {
  opacity: 0.85;
}

/* Success Modal / Result View */
.success-card {
  display: none;
  text-align: center;
  padding: 2.75rem 1.75rem;
  animation: zoomIn 0.4s ease-out;
}

.success-card.active {
  display: block;
}

.success-icon-wrapper {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: #ecfdf5;
  border: 2px solid var(--success);
  color: var(--success);
  font-size: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: 0 6px 25px rgba(5, 150, 105, 0.2);
}

.success-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy-main);
  margin-bottom: 0.5rem;
}

.success-desc {
  color: var(--text-secondary);
  font-size: 0.98rem;
  max-width: 480px;
  margin: 0 auto 1.75rem;
}

.receipt-summary-box {
  background: #f8fafc;
  border: 1.5px solid rgba(197, 155, 39, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 460px;
  margin: 0 auto 2rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  text-align: right;
  box-shadow: var(--shadow-sm);
}

.receipt-photo {
  width: 80px;
  height: 96px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 2px solid var(--gold-primary);
  flex-shrink: 0;
  background: #fff;
}

.receipt-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
}

.receipt-name-ar {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy-main);
}

.receipt-name-en {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--gold-dark);
  font-family: 'Outfit', sans-serif;
  direction: ltr;
  text-align: left;
}

.receipt-role {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Footer */
.portal-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.portal-footer a {
  color: var(--navy-light);
  text-decoration: none;
  font-weight: 700;
  transition: color var(--transition-fast);
}

.portal-footer a:hover {
  color: var(--gold-dark);
  text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

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

/* Mobile Responsive Optimization */
@media (max-width: 640px) {
  .app-container {
    padding: 1.25rem 0.85rem;
  }
  
  .glass-card {
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-md);
  }
  
  .portal-title {
    font-size: 1.5rem;
  }
  
  .logo-img {
    max-height: 95px;
  }
  
  .photo-preview-wrapper {
    flex-direction: column;
    text-align: center;
  }
  
  .preview-info {
    align-items: center;
  }
  
  .preview-filename, .preview-filesize {
    text-align: center;
  }
  
  .receipt-summary-box {
    flex-direction: column;
    text-align: center;
  }
  
  .receipt-name-en {
    text-align: center;
  }
}
