/* Overlay */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.onboarding-overlay.visible {
    opacity: 1;
}

.welcome-container {
    text-align: center;
    max-width: 380px;
    padding: 0 20px;
}

.welcome-icon {
    font-size: 40px;
    margin-bottom: 20px;
}

.welcome-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.welcome-text {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-bottom: 28px;
    line-height: 1.5;
}

.btn-welcome {
    padding: 13px 40px;
    background: var(--color-gold);
    color: var(--color-bg-primary);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-welcome:hover {
    opacity: 0.9;
}

/* Main Modal */
.onboarding-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.onboarding-modal.active {
    display: flex;
}

.modal-container {
    background: var(--color-bg-secondary);
    border-radius: 16px;
    width: 100%;
    max-width: 580px;
    padding: 36px;
    max-height: 88vh;
    overflow-y: auto;
}

/* Progress */
.progress-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 36px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border);
    transition: all 0.3s;
}

.dot.active {
    background: var(--color-gold);
    width: 28px;
    border-radius: 4px;
}

/* Steps */
.modal-step {
    display: none;
}

.modal-step.active {
    display: block;
}

.step-header {
    text-align: center;
    margin-bottom: 32px;
}

.step-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 10px;
}

.step-subtitle {
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Habits Pills */
.pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
}

.pill {
    padding: 9px 16px;
    background: var(--color-bg-elevated);
    border: 2px solid transparent;
    border-radius: 24px;
    font-size: 13px;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.pill:hover {
    border-color: rgba(212, 175, 55, 0.5);
}

.pill.selected {
    background: var(--color-gold);
    border-color: var(--color-gold);
    color: var(--color-bg-primary);
}

.pill.add-custom {
    border: 2px dashed var(--color-border);
    background: transparent;
}

.pill.add-custom:hover {
    border-color: var(--color-gold);
    background: rgba(212, 175, 55, 0.1);
}

/* Custom Habit Modal */
.custom-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10002;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.custom-modal.active {
    display: flex;
}

.custom-box {
    background: var(--color-bg-secondary);
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    padding: 28px;
}

.custom-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 16px;
}

.custom-input {
    width: 100%;
    padding: 13px 16px;
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--color-text-primary);
    margin-bottom: 20px;
}

.custom-input:focus {
    outline: none;
    border-color: var(--color-gold);
}

.custom-actions {
    display: flex;
    gap: 12px;
}

.btn-custom-cancel,
.btn-custom-add {
    flex: 1;
    padding: 11px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-custom-cancel {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
}

.btn-custom-add {
    background: var(--color-gold);
    color: var(--color-bg-primary);
}

/* Loader */
.loader-step {
    text-align: center;
    padding: 60px 0;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-bg-elevated);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

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

.loader-text {
    font-size: 15px;
    color: var(--color-text-secondary);
}

/* Email Step */
.email-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 28px;
}

.email-field {
    width: 100%;
    padding: 13px 16px;
    background: var(--color-bg-primary);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--color-text-primary);
    margin-bottom: 10px;
}

.email-field:focus {
    outline: none;
    border-color: var(--color-gold);
}

.email-hint {
    font-size: 13px;
    color: var(--color-text-tertiary);
    margin-bottom: 24px;
    text-align: center;
}

.error-msg {
    padding: 12px 16px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid #ff4444;
    border-radius: 8px;
    color: #ff4444;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

/* Tutorial */
.tutorial-content {
    text-align: center;
}

.tutorial-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 20px;
}

.tutorial-media {
    width: 100%;
    max-width: 320px;
    height: 200px;
    background: var(--color-bg-elevated);
    border-radius: 12px;
    margin: 0 auto 24px;
    overflow: hidden;
}

.tutorial-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tutorial-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 10px;
}

.tutorial-desc {
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* Footer */
.modal-footer {
    margin-top: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.modal-footer.hide {
    display: none !important;
}

.btn-back {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.btn-back:hover {
    color: var(--color-text-primary);
}

.btn-next {
    padding: 12px 48px;
    background: var(--color-gold);
    color: var(--color-bg-primary);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-next:hover {
    opacity: 0.9;
}

.btn-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 768px) {
    .modal-container {
        padding: 28px 24px;
    }

    .step-title {
        font-size: 20px;
    }

    .pills-container {
        gap: 6px;
    }

    .pill {
        padding: 7px 12px;
        font-size: 12px;
    }

    .email-field,
    .custom-input {
        font-size: 16px; /* Prevent iOS zoom */
    }

    .tutorial-media {
        max-width: 280px;
        height: 180px;
    }
}
