/* ========================================
   Eid Card Generator - Styles
   MSC-NMU - 2-Step Journey Design
   ======================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0a1628 0%, #0d2d5e 50%, #0a1628 100%);
  min-height: 100vh;
  color: #ffffff;
  overflow-x: hidden;
}

/* === Step 1: Input Page === */
.input-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.input-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

/* Logo */
.logo-wrapper {
  text-align: center;
  margin-bottom: 24px;
}

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

/* Title */
.title {
  font-family: 'Tajawal', sans-serif;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: #ffffff;
}

.subtitle {
  font-size: 15px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 32px;
}

/* Form */
#cardForm {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

.form-group input[type="text"] {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  color: #ffffff;
  transition: all 0.2s ease;
}

.form-group input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: #0078d4;
  background: rgba(0, 120, 212, 0.1);
}

.form-group input[type="text"].error {
  border-color: #e74c3c;
}

/* Error Messages */
.error-message {
  font-size: 13px;
  color: #e74c3c;
  display: none;
}

.error-message.visible {
  display: block;
}

/* Upload Area */
.upload-area {
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.upload-area:hover {
  border-color: #0078d4;
  background: rgba(0, 120, 212, 0.08);
}

.upload-area.drag-over {
  border-color: #0078d4;
  background: rgba(0, 120, 212, 0.15);
  transform: scale(1.01);
}

.upload-area.error {
  border-color: #e74c3c;
}

.upload-icon-wrapper {
  width: 64px;
  height: 64px;
  background: rgba(0, 120, 212, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.upload-icon {
  color: #0078d4;
}

.upload-text {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
}

/* Uploaded Preview */
.uploaded-preview {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: rgba(0, 0, 0, 0.3);
}

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

.remove-image {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-image:hover {
  background: #e74c3c;
  transform: scale(1.1);
}

/* Generate Button */
.btn-generate {
  background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
  border: none;
  border-radius: 14px;
  padding: 18px 32px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 120, 212, 0.4);
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 120, 212, 0.5);
}

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

/* === Step 2: Modal Overlay === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Content */
.modal-content {
  background: linear-gradient(135deg, #0d1b2a 0%, #1b3a5f 100%);
  border-radius: 24px;
  padding: 40px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.5s ease-out, opacity 0.5s ease-out;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 10;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
  opacity: 1;
}

.modal-title {
  font-family: 'Tajawal', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 24px;
}

/* Canvas Wrapper */
.canvas-wrapper {
  background: #ffffff;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 24px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.8);
  opacity: 0;
  transition: transform 0.6s ease-out 0.2s, opacity 0.6s ease-out 0.2s;
}

.modal-overlay.active .canvas-wrapper {
  transform: scale(1);
  opacity: 1;
}

#cardCanvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-action {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-download {
  background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
  color: #ffffff;
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 120, 212, 0.4);
}

.btn-share {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-share:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* Back Button */
.btn-back {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  transition: all 0.2s ease;
}

.btn-back:hover {
  color: #ffffff;
}

/* === Confetti Animation === */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  opacity: 0;
  animation: confettiFall 3s ease-out forwards;
}

.confetti.circle {
  border-radius: 50%;
}

.confetti.square {
  border-radius: 2px;
}

.confetti.ribbon {
  width: 8px;
  height: 20px;
  border-radius: 2px;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg);
  }
}

/* === Sparkles Animation === */
.sparkles-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sparkle {
  position: absolute;
  font-size: 24px;
  color: #ffd700;
  opacity: 0;
  animation: sparkleAnim 1.5s ease-out forwards;
}

@keyframes sparkleAnim {
  0% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.2) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.8) rotate(360deg);
  }
}

/* === Notification === */
.notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px 28px;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 14px;
  z-index: 2000;
  animation: notificationSlide 0.3s ease-out;
}

@keyframes notificationSlide {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* === Responsive === */
@media (max-width: 600px) {
  .input-card {
    padding: 32px 24px;
    border-radius: 20px;
  }

  .title {
    font-size: 26px;
  }

  .modal-content {
    padding: 24px;
    border-radius: 20px;
  }

  .modal-title {
    font-size: 22px;
  }

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

  .btn-action {
    width: 100%;
  }
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0a1628;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 120, 212, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #0078d4;
}

/* === Selection === */
::selection {
  background: #0078d4;
  color: white;
}
