/**
 * Shared Onboarding Styles
 * Common components used across multiple onboarding steps
 */

/* ========================================
   ONBOARDING CIRCULAR PROGRESS BAR
   ======================================== */

#onboarding-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

.onboarding-progress-bar {
    position: absolute;
    background: #ffffff;
    transition: all 0.5s ease-in-out;
}

/* Left side - top to bottom (last 25% of progress) */
#onboarding-progress-left {
    left: 0;
    top: 0;
    width: 8px;
    height: 0%;
}

/* Top side - right to left (50-75% of progress) */
#onboarding-progress-top {
    right: 0;
    top: 0;
    width: 0%;
    height: 8px;
}

/* Right side - bottom to top (25-50% of progress) */
#onboarding-progress-right {
    right: 0;
    bottom: 0;
    width: 8px;
    height: 0%;
}

/* Bottom side - left to right (0-25% of progress) */
#onboarding-progress-bottom {
    left: 0;
    bottom: 0;
    width: 0%;
    height: 8px;
}

@keyframes bubble-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

#onboarding-progress-bubble {
    position: fixed;
    background: var(--color-surface);
    color: var(--color-text);
    border: 2px solid #ffffff;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    transition: all 0.5s ease-in-out;
    animation: bubble-pulse 2s ease-in-out infinite;
}

.theme-dark #onboarding-progress-bubble {
    background: #2a2a2a;
    color: #ffffff;
}

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

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

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

body {
    overflow-x: hidden;
}

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

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

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

.page-subtitle {
    text-align: center;
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
}

.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);
}

.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);
    min-height: 44px; /* Accessibility: minimum touch target */
}

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

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

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

.progress-dot::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gray-400);
    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
   ======================================== */

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

.slide-group {
    position: absolute;
    width: 100%;
    min-height: 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 .slide-group {
    background: var(--color-surface);
}

.slide-group.current {
    transform: translateX(0);
    opacity: 1;
    z-index: 10;
}

.slide-group.next {
    transform: translateX(100%);
    opacity: 0;
    z-index: 5;
}

.slide-group.prev {
    transform: translateX(-100%);
    opacity: 0;
    z-index: 5;
}

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

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

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

.slide-group.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 {
    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;
}

.form-input:focus,
.form-select: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;
}

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

.checkbox-option,
.radio-option {
    position: relative;
}

.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 {
    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;
}

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

.checkbox-option input[type="checkbox"]:checked + .checkbox-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,
.radio-option input[type="radio"]:focus-visible + .radio-button {
    outline: 2px solid var(--brand-1);
    outline-offset: 2px;
}

/* ========================================
   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) {
    .slide-group,
    .nav-btn,
    .progress-dot,
    .checkbox-button,
    .radio-button {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

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

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

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

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

    .slide-group {
        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;
    }
}

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

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

    .navigation-buttons {
        gap: 8px;
    }

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

    .slide-group {
        padding: 20px;
    }
}
