/**
 * Onboarding Steps - Comprehensive Styles
 * All styles for onboarding step templates
 * Last updated: 2025-01-16
 */

/* ========================================
   CONTAINER & LAYOUT
   ======================================== */

.main-card {
    max-width: 900px;
    margin: 2rem auto;
    overflow: visible;
}

.onboarding-container,
.goal-container,
.form-container {
    padding: 0;
    overflow: visible;
}

body {
    overflow-x: hidden;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

.page-title,
.email-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.page-subtitle,
.email-description {
    text-align: center;
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.group-header {
    text-align: center;
    margin-bottom: 30px;
}

.group-subtitle {
    font-size: 1rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* ========================================
   NAVIGATION BUTTONS
   ======================================== */

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    gap: 10px;
}

.nav-btn {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text);
    min-height: 44px; /* Accessibility: minimum touch target */
}

.theme-dark .nav-btn {
    background: var(--color-surface);
}

.nav-btn:hover:not(:disabled) {
    border-color: var(--brand-1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hov);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn:focus-visible {
    outline: 2px solid var(--brand-1);
    outline-offset: 2px;
}

.nav-btn.primary {
    background: var(--grad-brand);
    border: none;
    color: var(--white);
}

/* ========================================
   PROGRESS DOTS
   ======================================== */

.progress-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
}

.progress-dot {
    width: 44px; /* Accessibility: minimum touch target (44x44px) */
    height: 44px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
}

.progress-dot::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gray-300);
    transition: all 0.3s ease;
}

.progress-dot.active::before {
    background: var(--brand-1);
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(var(--brand-1-rgb), 0.5);
}

.progress-dot.completed::before {
    background: var(--success);
    box-shadow: 0 0 8px rgba(var(--success-rgb), 0.5);
}

.progress-dot:focus-visible {
    outline: 2px solid var(--brand-1);
    outline-offset: 2px;
}

/* Screen reader text for progress dots */
.progress-dot-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   SLIDE ANIMATIONS & WRAPPER
   ======================================== */

.group-wrapper {
    position: relative;
    width: 100%;
    min-height: 400px;
    overflow: hidden;
}

.goal-group,
.form-group-page {
    position: absolute;
    width: 100%;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
    box-shadow: var(--shadow-card);
    overflow: visible;
}

.theme-dark .goal-group,
.theme-dark .form-group-page {
    background: var(--color-surface);
}

.goal-group.current,
.form-group-page.current {
    transform: translateX(0);
    opacity: 1;
    z-index: 10;
}

.goal-group.next,
.form-group-page.next {
    transform: translateX(100%);
    opacity: 0;
    z-index: 5;
}

.goal-group.prev,
.form-group-page.prev {
    transform: translateX(-100%);
    opacity: 0;
    z-index: 5;
}

.goal-group.slide-out-left,
.form-group-page.slide-out-left {
    animation: slideOutLeft 0.5s ease forwards;
}

.goal-group.slide-in-right,
.form-group-page.slide-in-right {
    animation: slideInRight 0.5s ease forwards;
}

.goal-group.slide-out-right,
.form-group-page.slide-out-right {
    animation: slideOutRight 0.5s ease forwards;
}

.goal-group.slide-in-left,
.form-group-page.slide-in-left {
    animation: slideInLeft 0.5s ease forwards;
}

@keyframes slideOutLeft {
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.form-input,
.form-select,
.email-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 16px;
    background: var(--color-header-bg);
    color: var(--color-text);
    transition: border-color 0.3s ease;
}

.email-input {
    padding: 14px 18px;
    border-radius: 12px;
}

.form-input:focus,
.form-select:focus,
.email-input:focus {
    outline: none;
    border-color: var(--brand-1);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-1-rgb), 0.25);
}

.form-select {
    cursor: pointer;
}

.email-input::placeholder {
    color: var(--color-text-secondary);
}

/* Form field groups */
.form-fields {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 30px;
}

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

.field-label {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-text);
}

.field-label .required {
    color: var(--danger);
    margin-left: 4px;
}

.field-description {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-top: -4px;
}

/* Email form specific */
.email-form-group {
    margin-bottom: 1.5rem;
}

.email-card {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px;
}

.email-icon {
    text-align: center;
    margin-bottom: 30px;
    font-size: 48px;
    color: var(--brand-1, #667EEA);
}

/* ========================================
   CHECKBOX & RADIO BUTTONS (GOAL STYLE)
   ======================================== */

.checkbox-group,
.radio-group,
.goal-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.goal-options {
    gap: 15px;
    margin-bottom: 30px;
}

.checkbox-option,
.radio-option {
    position: relative;
    display: flex;
    justify-content: center;
}

.checkbox-option input[type="checkbox"],
.radio-option input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.checkbox-button,
.radio-button,
.goal-button {
    cursor: pointer;
    display: block;
    width: 100%;
    min-height: 50px;
    padding: 14px 20px;
    text-align: left;
    border-radius: 12px;
    background-color: var(--gray-200);
    color: var(--gray-700);
    font-weight: 500;
    font-size: 16px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.goal-button {
    text-align: center;
    line-height: 26px;
    padding: 12px 20px;
    border-radius: 15px;
    color: var(--gray-600);
    font-weight: 600;
    font-size: 18px;
    border: none;
}

.checkbox-button:hover,
.radio-button:hover,
.goal-button:hover {
    background-color: var(--gray-300);
    transform: translateY(-1px);
}

.goal-button:hover {
    color: var(--gray-700);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--black-rgb), 0.1);
}

.checkbox-option input[type="checkbox"]:checked + .checkbox-button,
.checkbox-option input[type="checkbox"]:checked + .goal-button,
.radio-option input[type="radio"]:checked + .radio-button {
    background: var(--grad-brand);
    color: var(--white);
    border-color: var(--brand-1);
    box-shadow: var(--shadow-hov);
}

.checkbox-option input[type="checkbox"]:focus-visible + .checkbox-button,
.checkbox-option input[type="checkbox"]:focus-visible + .goal-button,
.radio-option input[type="radio"]:focus-visible + .radio-button {
    outline: 2px solid var(--brand-1);
    outline-offset: 2px;
}

/* ========================================
   COACH SELECTION
   ======================================== */

.coach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.coach-card {
    background: var(--color-surface, #fff);
    border: 2px solid var(--color-border, #e0e0e0);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 44px; /* Accessibility: minimum touch target */
}

.coach-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-color: var(--bs-primary, #667EEA);
}

.coach-card.selected {
    border-color: var(--bs-primary, #667EEA);
    background: rgba(102, 126, 234, 0.05);
}

.coach-card-radio {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.coach-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 10px;
    overflow: hidden;
    background: var(--color-surface-secondary, #f5f5f5);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.coach-avatar-placeholder {
    font-size: 40px;
    color: var(--color-text-secondary, #888);
}

.coach-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--color-text, #333);
    margin-bottom: 6px;
    text-align: center;
}

.coach-description {
    font-size: 14px;
    color: var(--color-text-secondary, #666);
    line-height: 1.4;
    text-align: center;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-dark .coach-card {
    background: var(--color-surface, #1a1a1a);
    border-color: var(--color-border, #333);
}

.theme-dark .coach-card.selected {
    background: rgba(102, 126, 234, 0.15);
}

.theme-dark .coach-name {
    color: var(--color-text, #fff);
}

.theme-dark .coach-description {
    color: var(--color-text-secondary, #aaa);
}

/* ========================================
   CONSENT CONTAINER (Email Consent)
   ======================================== */

.consent-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--color-surface);
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.theme-dark .consent-container {
    background: var(--color-surface);
}

.consent-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.consent-checkbox input[type="checkbox"] {
    margin-top: 4px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.consent-label {
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
}

.consent-label a {
    color: var(--brand-1);
    text-decoration: underline;
}

.consent-label a:hover {
    color: var(--brand-1-hover);
}

.privacy-links {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.privacy-links a {
    color: var(--brand-1);
    text-decoration: none;
    margin: 0 10px;
}

.privacy-links a:hover {
    text-decoration: underline;
}

/* ========================================
   SUBMIT BUTTONS
   ======================================== */

.submit-btn {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    background: var(--grad-brand);
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1.5rem;
    min-height: 44px; /* Accessibility: minimum touch target */
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hov);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.submit-btn:focus-visible {
    outline: 2px solid var(--brand-1);
    outline-offset: 2px;
}

/* ========================================
   PERSONAL SUMMARY TEXTAREA
   ======================================== */

.summary-textarea {
    width: 100%;
    min-height: 150px;
    border-radius: 15px;
    border: 2px solid var(--color-border);
    padding: 15px 20px;
    font-size: 16px;
    resize: vertical;
    transition: border-color 0.3s ease;
    background: var(--color-header-bg);
    color: var(--color-text);
    margin-bottom: 20px;
}

.summary-textarea:focus {
    outline: none;
    border-color: var(--brand-1);
    box-shadow: 0 0 0 0.2rem rgba(var(--brand-1-rgb), 0.25);
}

.char-counter {
    text-align: center;
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-top: -10px;
    margin-bottom: 20px;
}

/* ========================================
   LOADING STATES
   ======================================== */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ========================================
   ERROR MESSAGES
   ======================================== */

.error-message {
    background: var(--danger-light, #f8d7da);
    border: 1px solid var(--danger, #dc3545);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    color: var(--danger-dark, #721c24);
}

.theme-dark .error-message {
    background: rgba(220, 53, 69, 0.2);
    border-color: var(--danger);
    color: var(--danger-light);
}

.error-message ul {
    margin: 0;
    padding-left: 20px;
}

.error-message li {
    margin: 4px 0;
}

/* Live region for screen readers */
.sr-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   MOTION PREFERENCES
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .goal-group,
    .form-group-page,
    .nav-btn,
    .progress-dot,
    .checkbox-button,
    .radio-button,
    .goal-button,
    .coach-card {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .main-card {
        margin: 1rem;
    }

    .page-title,
    .email-title {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .page-subtitle,
    .email-description {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .goal-group,
    .form-group-page {
        padding: 25px;
    }

    .email-card {
        padding: 25px;
    }

    .group-subtitle {
        font-size: 0.9rem;
    }

    .nav-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .checkbox-button,
    .radio-button {
        font-size: 14px;
        padding: 10px 18px;
    }

    .goal-button {
        font-size: 16px;
        padding: 10px 18px;
    }

    .coach-grid {
        grid-template-columns: 1fr;
    }

    .consent-container {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .main-card {
        margin: 0.5rem;
    }

    .page-title,
    .email-title {
        font-size: 1.25rem;
    }

    .navigation-buttons {
        gap: 8px;
    }

    .nav-btn {
        padding: 8px 15px;
        font-size: 13px;
    }

    .goal-group,
    .form-group-page {
        padding: 20px;
    }
}
