/**
 * Standardized Forms Stylesheet
 * Used across all StudioPartner form templates
 * Based on Apple-inspired design principles
 */

/* ========================================
   CSS Variables (Set dynamically via inline style or JS)
   ======================================== */

:root {
  --primary-color: #027dfd;
  --background-color: #F5F5F7;
}

/* ========================================
   Base Styles & Reset
   ======================================== */

* {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
               Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--background-color, #F5F5F7);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

/* ========================================
   Container
   ======================================== */

.container {
  background-color: #fff;
  padding: 40px;
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  text-align: center;
  position: relative;
}

/* ========================================
   Logo
   ======================================== */

.logo {
  display: block;
  margin: 0 auto 32px auto;
  max-width: 180px;
  max-height: 100px;
  width: auto;
  height: auto;
}

img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   Typography
   ======================================== */

h1 {
  color: #1c1c1e;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
}

h2 {
  color: #1c1c1e;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.3;
}

h3 {
  color: #1c1c1e;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

p {
  color: #6e6e73;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Additional text color utilities */
.text-primary {
  color: #1c1c1e;
}

.text-secondary {
  color: #6e6e73;
}

.text-muted {
  color: #999;
}

.text-dark {
  color: #333;
}

.text-medium {
  color: #666;
}

.text-light {
  color: #888;
}

.text-error {
  color: #dc2626;
}

.text-success {
  color: #2d7a3d;
}

.text-info {
  color: #0c5460;
}

/* Font size utilities */
.text-xs {
  font-size: 12px;
}

.text-sm {
  font-size: 14px;
}

.text-base {
  font-size: 16px;
}

.text-lg {
  font-size: 18px;
}

.text-xl {
  font-size: 22px;
}

.text-2xl {
  font-size: 24px;
}

.text-3xl {
  font-size: 28px;
}

/* Font weight utilities */
.font-normal {
  font-weight: 400;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-extrabold {
  font-weight: 800;
}

/* Text alignment utilities */
.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* Line height utilities */
.leading-tight {
  line-height: 1.25;
}

.leading-normal {
  line-height: 1.5;
}

.leading-relaxed {
  line-height: 1.625;
}

/* ========================================
   Form Elements
   ======================================== */

.form-field,
.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-field label,
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #444;
}

.form-field input,
.form-group input,
.form-field select,
.form-group select,
.form-field textarea,
.form-group textarea {
  width: 100%;
  font-size: 16px;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease;
  background-color: white;
  font-family: inherit;
}

.form-field textarea,
.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Dynamic border color using CSS variable */
.form-field input:focus,
.form-group input:focus,
.form-field select:focus,
.form-group select:focus,
.form-field textarea:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
}

/* ========================================
   Phone Input Components
   ======================================== */

.phone-input-container {
  display: flex;
  gap: 8px;
}

.phone-prefix-select {
  flex: 0 0 120px;
  font-size: 16px;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease;
  background-color: white;
  cursor: pointer;
}

.phone-prefix-select:focus {
  border-color: var(--primary-color);
}

.phone-number-input {
  flex: 1;
}

.phone-error {
  display: none;
  color: #dc2626;
  font-size: 12px;
  margin-top: 4px;
}

/* ========================================
   Gym Selector
   ======================================== */

.gym-selector {
  width: 100%;
  font-size: 16px;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease;
  background-color: white;
  cursor: pointer;
}

.gym-selector:focus {
  border-color: var(--primary-color);
}

/* ========================================
   Buttons
   ======================================== */

.button,
.cta-button {
  width: 100%;
  font-size: 16px;
  font-weight: 600;
  padding: 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 16px;
  transition: all 0.2s ease;
  font-family: inherit;
  background-color: var(--primary-color);
  color: white;
}

.button:hover,
.cta-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.button:active,
.cta-button:active {
  transform: translateY(0);
}

.button:disabled,
.cta-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ========================================
   Goal/Option Buttons
   ======================================== */

.goal-button,
.option {
  width: 100%;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 500;
  color: #374151;
  background-color: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.option-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.option-text {
  flex: 1;
}

.goal-button:hover,
.option:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.goal-button:active,
.option:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.option.selected {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

/* ========================================
   Consent Checkbox
   ======================================== */

.consent-container {
  margin-top: 20px;
  font-size: 12px;
  color: #666;
  line-height: 1.4;
  text-align: left;
}

.consent-container input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
  vertical-align: middle;
}

.consent-container label {
  vertical-align: middle;
}

/* ========================================
   Spinner & Loading States
   ======================================== */

.spinner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 16px;
  display: none;
  z-index: 10;
}

.spinner-overlay.active {
  display: flex;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========================================
   Success Message
   ======================================== */

.success-message,
.success-container {
  padding: 20px;
  background-color: #e6ffed;
  border: 1px solid #b3f0c7;
  border-radius: 8px;
  color: #2d7a3d;
  font-size: 16px;
}

.success-title {
  color: #2d7a3d;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.success-details {
  margin-top: 16px;
  font-size: 14px;
  color: #2d7a3d;
}

/* ========================================
   Success Animation
   ======================================== */

.success-animation {
  margin-bottom: 24px;
}

.checkmark-circle {
  width: 80px;
  height: 80px;
  margin: 0 auto;
  position: relative;
}

.checkmark {
  width: 80px;
  height: 80px;
  display: block;
}

.checkmark-circle-bg {
  stroke: #4ade80;
  stroke-width: 2;
  fill: none;
  animation: checkmark-circle 0.6s ease-in-out;
}

.checkmark-check {
  stroke: #4ade80;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkmark-check 0.4s 0.4s ease-in-out forwards;
}

@keyframes checkmark-circle {
  0% { stroke-dasharray: 0 157; }
  100% { stroke-dasharray: 157 157; }
}

@keyframes checkmark-check {
  to { stroke-dashoffset: 0; }
}

/* ========================================
   Page Navigation
   ======================================== */

.page {
  display: none;
}

.page.active {
  display: block;
}

/* ========================================
   Progress Bar
   ======================================== */

.progress-bar {
  width: 100%;
  height: 4px;
  background-color: #e5e5ea;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background-color: var(--primary-color);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.question-counter {
  background-color: #f2f2f7;
  color: #6e6e73;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  display: inline-block;
}

/* ========================================
   Promotion Specific
   ======================================== */

.promotion-header {
  margin-bottom: 24px;
}

.promotion-title {
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
}

.promotion-description {
  font-size: 16px;
  color: #666;
  line-height: 1.5;
}

.promotion-badge {
  display: inline-block;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ========================================
   Recommendation Specific
   ======================================== */

.recommendation-heading {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
}

.recommendation-steps {
  text-align: left;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recommendation-steps span,
.recommendation-steps p {
  display: block;
  margin: 0;
}

.recommendation-step {
  padding: 12px 0;
  border-bottom: 1px solid #e5e5ea;
  font-size: 14px;
  color: #6e6e73;
}

.recommendation-step:last-child {
  border-bottom: none;
}

/* ========================================
   Benefits Preview
   ======================================== */

.benefits-preview {
  margin: 24px 0;
  padding: 20px;
  background-color: #f2f2f7;
  border-radius: 12px;
  border: 1px solid #e5e5ea;
}

.benefit-item {
  color: #1c1c1e;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ========================================
   Responsive Design - Tablet
   ======================================== */

@media screen and (max-width: 768px) {
  .container {
    padding: 30px;
    max-width: 80%;
  }
  
  .logo {
    max-width: 130px;
    margin-bottom: 25px;
  }
  
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  .form-field label,
  .form-group label {
    font-size: 15px;
  }
  
  .form-field input,
  .form-group input,
  .form-field select,
  .form-group select,
  .form-field textarea,
  .form-group textarea {
    font-size: 15px;
    padding: 10px;
  }
  
  .button,
  .cta-button {
    font-size: 15px;
    padding: 12px;
  }
  
  .phone-prefix-select {
    font-size: 15px;
    padding: 10px;
  }
  
  .goal-button,
  .option {
    padding: 14px 18px;
    font-size: 15px;
  }
  
  .consent-container {
    font-size: 13px;
  }
}

/* ========================================
   Responsive Design - Mobile
   ======================================== */

@media screen and (max-width: 600px) {
  .container {
    padding: 20px;
    max-width: 90%;
  }
  
  .logo {
    max-width: 100px;
    margin-bottom: 20px;
  }
  
  h1 {
    font-size: 22px;
  }
  
  h2 {
    font-size: 18px;
  }
  
  .form-field input,
  .form-group input,
  .form-field select,
  .form-group select,
  .form-field textarea,
  .form-group textarea {
    font-size: 14px;
    padding: 10px;
  }
  
  .button,
  .cta-button {
    font-size: 14px;
    padding: 12px;
  }
  
  .phone-prefix-select {
    font-size: 14px;
    padding: 10px;
  }
  
  .goal-button,
  .option {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .consent-container {
    font-size: 12px;
  }
}

/* ========================================
   Responsive Design - Extra Small Mobile
   ======================================== */

@media screen and (max-width: 400px) {
  .container {
    padding: 15px;
  }
  
  .logo {
    max-width: 80px;
    margin-bottom: 15px;
  }
  
  h1 {
    font-size: 20px;
  }
  
  h2 {
    font-size: 16px;
  }
  
  .form-field input,
  .form-group input,
  .form-field select,
  .form-group select,
  .form-field textarea,
  .form-group textarea {
    font-size: 13px;
    padding: 8px;
  }
  
  .button,
  .cta-button {
    font-size: 13px;
    padding: 10px;
  }
  
  .phone-prefix-select {
    font-size: 13px;
    padding: 8px;
  }
  
  .goal-button,
  .option {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .consent-container {
    font-size: 12px;
  }
}
