/**
 * SSM Subscription Form Styles
 * 
 * Styles for the membership subscription form and overlay.
 * Works alongside AlpineJS for interactive behavior.
 * 
 * @package SurfstykSimplestMembership
 */

/* ===== COLOR PALETTE ===== */
:root {
  --ocean-teal: #00FFBF;
  --soft-teal: #5AB3A6;
  --medium-teal: #2D818E;
  --muted-sage: #BCC6A1;
  --deep-ocean-blue: #113C46;
  --charcoal: #1F1F1F;
}

body {
  font-family: 'Inter', sans-serif;
}

h1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--charcoal);
}
h2 {
  font-family: 'Outfit', sans-serif;
  font-weight: 500;
  color: var(--charcoal);
}
h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 400;
  color: var(--charcoal);
}
.mono {
  font-family: 'IBM Plex Mono', monospace;
}

/* ===== FORM CONTAINER ===== */
.ssm-membership-form {
    /* Base form styling */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #374151;
}

/* ===== FORM GROUP ===== */
.form-group, .ssm-form-group {
    margin-bottom: 16px;
}

/* ===== LABEL ===== */
label, .ssm-form-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 15px;
    color: var(--charcoal);
    display: block;
    margin-bottom: 4px;
    letter-spacing: 0.01em;
}

/* ===== INPUTS, TEXTAREA, SELECT ===== */
input, textarea, select, .ssm-form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--deep-ocean-blue);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    background: #FFFFFF;
    color: var(--deep-ocean-blue);
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
}
input::placeholder, textarea::placeholder {
    color: var(--muted-sage);
    opacity: 1;
    font-size: 16px;
}
input:focus, textarea:focus, select:focus, .ssm-form-input:focus {
    outline: 2px solid var(--ocean-teal);
    outline-offset: 0;
    border-color: var(--ocean-teal);
    background: #FFFFFF;
}

/* ===== ERROR STATES ===== */
input.error, textarea.error, select.error, .ssm-form-input.ssm-has-error {
    border: 2px solid #FF3B30;
    background: #FFF5F5;
}
.error-message, .ssm-error-message {
    color: #FF3B30;
    font-size: 15px;
    margin-top: 4px;
    font-family: 'Inter', sans-serif;
}

/* ===== CHECKBOX STYLING ===== */
.ssm-checkbox-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.ssm-checkbox {
    height: 1rem;
    width: 1rem;
    color: #3b82f6;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    margin-top: 0.25rem;
    margin-right: 0.5rem;
}

.ssm-checkbox:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ssm-checkbox-label {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
}

.ssm-checkbox-label a {
    color: #3b82f6;
    text-decoration: underline;
}

.ssm-checkbox-label a:hover {
    color: #1d4ed8;
}

/* ===== CTA BUTTON ===== */
.ssm-submit-button, .btn-cta {
    background: #2D5B7E;
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(45, 91, 126, 0.2);
    padding: 12px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    font-size: 18px;
    display: block;
    margin: 24px auto 0 auto;
    width: auto;
    min-width: 180px;
    max-width: 100%;
    font-family: 'Inter', sans-serif;
}
.ssm-submit-button:hover:not(:disabled), .btn-cta:hover:not(:disabled) {
    background: var(--ocean-teal);
    color: var(--deep-ocean-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -1px rgba(45, 91, 126, 0.25);
}
.ssm-submit-button:focus, .btn-cta:focus {
    outline: 2px solid var(--ocean-teal);
    box-shadow: 0 0 0 3px var(--ocean-teal);
}
.ssm-submit-button:disabled, .btn-cta:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== SUCCESS STATE ===== */
.ssm-success-state {
    text-align: center;
    color: #059669;
    margin-bottom: 1rem;
}

.ssm-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 0.5rem;
    fill: none;
    stroke: var(--medium-teal);
    display: block;
}

.ssm-success-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.ssm-success-message {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ===== ERROR STATE ===== */
.ssm-error-state {
    color: #dc2626;
    text-align: center;
    padding: 0.75rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

/* ===== OVERLAY STYLING ===== */
.ssm-overlay-inner {
    /* Overlay container styling */
    padding: 2rem;
    text-align: center;
}

.ssm-overlay-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #1f2937;
}

.ssm-overlay-description {
    margin-bottom: 1.5rem;
    color: #6b7280;
    line-height: 1.6;
}

.ssm-overlay-footer {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #9ca3af;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 640px) {
    .ssm-overlay-inner {
        padding: 1.5rem;
    }
    
    .ssm-overlay-title {
        font-size: 1.25rem;
    }
    
    .ssm-form-input {
        font-size: 1rem; /* Prevent zoom on iOS */
    }
}

/* ===== ANIMATIONS ===== */
@keyframes ssm-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ssm-fade-in {
    animation: ssm-fade-in 0.3s ease-out;
}

/* ===== LOADING STATES ===== */
.ssm-loading {
    position: relative;
    pointer-events: none;
}

.ssm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: ssm-spin 1s linear infinite;
}

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

/* ===== ACCESSIBILITY ===== */
.ssm-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .ssm-form-input {
        border-width: 2px;
    }
    
    .ssm-submit-button {
        border: 2px solid #1d4ed8;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .ssm-submit-button,
    .ssm-form-input {
        transition: none;
    }
    
    .ssm-fade-in {
        animation: none;
    }
    
    .ssm-loading::after {
        animation: none;
    }
}

/* ===== TOGGLE SWITCH ===== */
.toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--muted-sage);
  transition: .4s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
.toggle input:checked + .slider {
  background-color: var(--charcoal);
}
.toggle input:checked + .slider:before {
  transform: translateX(26px);
} 