/* Base Styles and Variables */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.2);
  --text-dark: #2d3748;
  --text-light: #718096;
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.15);
  --border-radius: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modern Background */
.modern-bg {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Animated Background Elements */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.floating-element {
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: float var(--duration, 10s) var(--delay, 0s) infinite ease-in-out;
}

.floating-element:nth-child(1) { top: 10%; left: 10%; }
.floating-element:nth-child(2) { top: 20%; right: 15%; width: 150px; height: 150px; }
.floating-element:nth-child(3) { bottom: 30%; left: 20%; animation-direction: reverse; }
.floating-element:nth-child(4) { bottom: 20%; right: 25%; width: 80px; height: 80px; }
.floating-element:nth-child(5) { top: 50%; left: 50%; width: 120px; height: 120px; }

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.3; }
  25% { transform: translateY(-20px) rotate(90deg); opacity: 0.5; }
  50% { transform: translateY(-10px) rotate(180deg); opacity: 0.3; }
  75% { transform: translateY(-30px) rotate(270deg); opacity: 0.4; }
}

/* Glass Navbar */
.glass-navbar {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.brand-logo {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white !important;
  text-decoration: none;
  transition: var(--transition);
}

.brand-logo:hover {
  transform: scale(1.05);
  color: white !important;
}

.brand-icon {
  font-size: 2rem;
  margin-right: 0.5rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.brand-text {
  background: linear-gradient(45deg, #fff, #f0f8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white !important;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
  text-decoration: none;
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  color: white !important;
}

/* Hero Section */
.hero-section {
  position: relative;
  z-index: 1;
  padding: 8rem 0 4rem;
}

.hero-content {
  padding-right: 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1.5rem;
  border-radius: 50px;
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInUp 1s ease-out;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  color: white;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  animation: slideInUp 1s ease-out 0.2s both;
}

.gradient-text {
  background: linear-gradient(45deg, #4ade80, #22d3ee, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(90deg); }
}

.hero-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
  animation: slideInUp 1s ease-out 0.4s both;
}

.hero-features {
  display: flex;
  gap: 2rem;
  animation: slideInUp 1s ease-out 0.6s both;
}

.feature-item {
  display: flex;
  align-items: center;
  color: white;
  font-weight: 500;
}

.feature-icon {
  font-size: 1.5rem;
  margin-right: 0.5rem;
}

/* Photo Booth Form */
.photo-booth-form {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-soft);
  animation: slideInUp 1s ease-out 0.8s both;
  position: relative;
  overflow: hidden;
}

.photo-booth-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #4ade80, #22d3ee, #a855f7);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

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

.form-title {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.5rem;
}

.form-subtitle {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0;
}

/* Modern Input Styling */
.input-group-modern {
  position: relative;
  margin-bottom: 1.5rem;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  font-size: 1.2rem;
}

.form-control-modern {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  color: white;
  transition: var(--transition);
  position: relative;
}

.form-control-modern::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.form-control-modern:focus {
  outline: none;
  border-color: #4ade80;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}

.input-border {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #4ade80, #22d3ee);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.form-control-modern:focus + .input-border {
  transform: scaleX(1);
}

/* Template Selection */
.template-selection {
  border: none;
  margin-bottom: 2rem;
}

.template-legend {
  font-size: 1.3rem;
  font-weight: 600;
  color: white;
  margin-bottom: 1.5rem;
  text-align: center;
  border: none;
  padding: 0;
}

.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.template-card {
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--border-radius);
  overflow: hidden;
  position: relative;
}

.template-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.template-card-inner {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}

.template-card:hover .template-card-inner {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(255, 255, 255, 0.4);
}

.template-card input:checked + .template-card-inner {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  box-shadow: 0 0 30px rgba(74, 222, 128, 0.3);
}

.template-preview {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.template-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.template-card:hover .template-image {
  transform: scale(1.05);
}

.template-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(74, 222, 128, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.template-card input:checked ~ .template-card-inner .template-overlay {
  opacity: 1;
}

.template-check {
  width: 60px;
  height: 60px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #4ade80;
  font-weight: bold;
  transform: scale(0);
  transition: var(--transition);
}

.template-card input:checked ~ .template-card-inner .template-check {
  transform: scale(1);
  animation: checkPop 0.3s ease-out;
}

@keyframes checkPop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.template-info {
  padding: 1.5rem;
  text-align: center;
}

.template-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: white;
  margin-bottom: 0.5rem;
}

.template-desc {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.template-badge {
  display: inline-block;
  background: linear-gradient(135deg, #4ade80, #22d3ee);
  color: white;
  padding: 0.3rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.template-badge-premium {
  background: linear-gradient(135deg, #a855f7, #ec4899);
}

/* Start Button */
.form-footer {
  text-align: center;
}

.btn-start-session {
  position: relative;
  background: linear-gradient(135deg, #4ade80, #22d3ee);
  color: white;
  border: none;
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 280px;
  justify-content: center;
}

.btn-start-session:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(74, 222, 128, 0.4);
}

.btn-start-session:disabled {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-start-session:active:not(:disabled) {
  transform: translateY(-1px);
}

.btn-text {
  transition: var(--transition);
}

.btn-icon {
  font-size: 1.3rem;
  transition: var(--transition);
}

.btn-start-session:hover:not(:disabled) .btn-icon {
  transform: translateX(5px);
}

.btn-ripple {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  transform: scaleX(0);
  transition: transform 0.6s ease;
}

.btn-start-session:hover:not(:disabled) .btn-ripple {
  transform: scaleX(1);
}

.error-message {
  color: #f87171;
  margin-top: 1rem;
  font-size: 0.9rem;
  opacity: 0;
  transition: var(--transition);
}

.error-message:not(:empty) {
  opacity: 1;
}

/* Features Section */
.features-section {
  position: relative;
  z-index: 1;
  padding: 4rem 0;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  text-align: center;
  margin-bottom: 3rem;
}

.feature-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  padding: 2rem;
  text-align: center;
  transition: var(--transition);
  height: 100%;
}

.feature-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(255, 255, 255, 0.4);
}

.feature-card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.feature-card h3 {
  color: white;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.feature-card p {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
  margin: 0;
}

/* Footer */
.glass-footer {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2rem 0;
  color: rgba(255, 255, 255, 0.8);
  position: relative;
  z-index: 1;
}

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

/* ===== EXISTING STYLES FROM ORIGINAL CSS ===== */

/* Hide radio inputs but keep them accessible */
.template-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Template Images */
.template-wrapper {
  width: 100%;
  height: 300px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.template-img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  user-select: none;
  pointer-events: none;
}

/* Template option label styling */
.template-option {
  cursor: pointer;
  display: block;
  user-select: none;
}

/* Style the button div inside label to look like a button */
.template-option .btn {
  margin-top: 0.5rem;
  pointer-events: none;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}

/* Show focus outline when radio input is focused */
.template-option input[type="radio"]:focus + img,
.template-option input[type="radio"]:focus + img + .btn {
  outline: 3px solid #0d6efd;
  outline-offset: 2px;
}

/* Show selected state */
.template-option input[type="radio"]:checked + img + .btn {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

/* Session Cards */
.session-card {
  border: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.session-card:hover {
  transform: translateY(-2px);
}

/* Photo Thumbnails */
.photo-thumbnail {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

.photo-thumbnail:hover {
  transform: scale(1.1);
}

.modal-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

/* Photo Strip Canvas */
.photo-strip-canvas {
  border: 2px solid #dee2e6;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  height: auto;
}

/* Editor Specific Thumbnails */
.photo-thumbnail {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #e9ecef;
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-thumbnail:hover {
  border-color: #0d6efd;
  transform: scale(1.05);
}

.photo-thumbnail.selected {
  border-color: #0d6efd;
  border-width: 3px;
}

/* Editor Controls */
.editor-controls {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.filter-btn {
  min-width: 80px;
  margin: 0.25rem;
}

.filter-btn.active {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.text-overlay-input {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ced4da;
  border-radius: 5px;
  padding: 0.5rem;
  width: 100%;
  margin-bottom: 0.5rem;
}

.color-picker {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  margin: 0.25rem;
}

#loading-spinner {
  display: none;
}

.session-info {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

/* Theme Button Styles */
.theme-btn.active {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.text-position-preview {
  font-size: 12px;
  color: #6c757d;
  text-align: center;
  margin-top: 5px;
}

.theme-preview {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  display: inline-block;
  margin-right: 5px;
  border: 2px solid #dee2e6;
}

.position-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 10px;
}

.orientation-controls {
  margin-top: 10px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-content {
    padding-right: 0;
    margin-bottom: 3rem;
    text-align: center;
  }
  
  .hero-features {
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .template-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .photo-booth-form {
    padding: 2rem 1.5rem;
  }
  
  .btn-start-session {
    min-width: auto;
    width: 100%;
  }
  
  .photo-strip-canvas {
    width: 100%;
  }
  
  .editor-controls {
    padding: 1rem;
  }
  
  .template-img {
    max-height: 300px;
  }
}

@media (max-width: 576px) {
  .hero-section {
    padding: 6rem 0 2rem;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .form-title {
    font-size: 1.5rem;
  }
  
  .features-section {
    padding: 2rem 0;
  }
  
  .section-title {
    font-size: 2rem;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
  
  .floating-element {
    display: none;
  }
}

/* ===== ACCESSIBILITY & PERFORMANCE ===== */

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
  .template-wrapper {
    background-color: #2d3748;
  }
  
  .editor-controls {
    background: #2d3748;
    color: white;
  }
  
  .text-overlay-input {
    background: rgba(45, 55, 72, 0.9);
    color: white;
    border-color: #4a5568;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .floating-element,
  .pulse-dot,
  .brand-icon {
    animation: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .glass-navbar,
  .photo-booth-form,
  .feature-card {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid white;
  }
  
  .template-card-inner {
    border: 2px solid white;
  }
  
  .btn-start-session {
    background: black;
    border: 2px solid white;
  }
}

/* Print styles */
@media print {
  .bg-animation,
  .glass-navbar,
  .glass-footer {
    display: none;
  }
  
  .modern-bg {
    background: white;
    color: black;
  }
}