/**
 * Onboarding Checklist Styles
 * 
 * Horizontal progress bar onboarding checklist that appears at the top 
 * of plugin admin pages when setup is incomplete.
 */

/* Main onboarding container */
#saiap-onboarding-checklist {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    padding: 0;
    margin: 16px 0;
    box-shadow: 0 4px 6px rgba(30, 58, 138, 0.1);
    position: relative;
    overflow: hidden;
}

#saiap-onboarding-checklist::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
}

.saiap-onboarding-container {
    padding: 18px; /* reduced ~25% */
}

/* Header section */
.saiap-onboarding-header {
    margin-bottom: 14px; /* reduced spacing */
    text-align: center;
}

.saiap-onboarding-header h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.saiap-onboarding-header p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Progress bar section */
.saiap-onboarding-progress {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px; /* reduced spacing */
    padding: 0 14px; /* reduced side padding */
}

.saiap-progress-bar {
    flex: 1;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.saiap-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    border-radius: 4px;
    transition: width 0.3s ease-in-out;
    position: relative;
}

.saiap-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.saiap-progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    min-width: 120px;
    text-align: right;
}

/* Steps container */
.saiap-onboarding-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 14px; /* reduced spacing */
}

/* Individual step */
.saiap-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px; /* reduced ~25% */
    background: #ffffff;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s ease-in-out;
    position: relative;
}

.saiap-step.completed {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.saiap-step.incomplete {
    border-color: #e5e7eb;
    background: #ffffff;
}

.saiap-step.incomplete:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(30, 58, 138, 0.1);
}

/* Step indicator */
.saiap-step-indicator {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.2s ease-in-out;
}

.saiap-step.completed .saiap-step-indicator {
    background-color: var(--success-color);
    color: #ffffff;
}

.saiap-step.incomplete .saiap-step-indicator {
    background-color: var(--neutral-border);
    color: var(--text-secondary);
}

.saiap-step.incomplete:hover .saiap-step-indicator {
    background-color: var(--primary-color);
    color: #ffffff;
}

.saiap-step-number {
    font-size: 14px;
    font-weight: 700;
}

.saiap-step-indicator .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Step content */
.saiap-step-content {
    flex: 1;
    min-width: 0;
}

.saiap-step-content h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.saiap-step-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.saiap-step-link {
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.saiap-step-link:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

.saiap-step-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Help section */
.saiap-onboarding-help {
    text-align: center;
    padding-top: 12px; /* reduced spacing */
    border-top: 1px solid #e5e7eb;
}

.saiap-onboarding-help p {
    margin: 4px 0; /* allow small separation for two lines */
    font-size: 14px;
    color: var(--text-secondary);
}

/* Upsell footnote (muted) */
.saiap-onboarding-upsell-footnote {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.85;
}

.saiap-help-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease-in-out;
}

.saiap-help-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Dismiss button styling */
#saiap-onboarding-checklist .notice-dismiss {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    transition: all 0.2s ease-in-out;
}

#saiap-onboarding-checklist .notice-dismiss:hover {
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#saiap-onboarding-checklist .notice-dismiss::before {
    color: var(--text-secondary);
    font-size: 16px;
}

#saiap-onboarding-checklist .notice-dismiss:hover::before {
    color: var(--text-primary);
}

/* Responsive design */
@media (max-width: 992px) {
    .saiap-onboarding-steps {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .saiap-onboarding-progress {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .saiap-progress-text {
        text-align: center;
        min-width: auto;
    }
}

@media (max-width: 576px) {
    .saiap-onboarding-container {
        padding: 16px;
    }
    
    .saiap-onboarding-header h3 {
        font-size: 18px;
    }
    
    .saiap-step {
        padding: 12px;
        gap: 10px;
    }
    
    .saiap-step-indicator {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .saiap-step-content h4 {
        font-size: 15px;
    }
    
    .saiap-step-content p {
        font-size: 13px;
    }
    
    .saiap-step-link {
        font-size: 13px;
    }
}

/* Animation for step completion */
.saiap-step.completed {
    animation: stepComplete 0.5s ease-in-out;
}

@keyframes stepComplete {
    0% {
        transform: scale(1);
        border-color: #e5e7eb;
    }
    50% {
        transform: scale(1.02);
        border-color: var(--success-color);
    }
    100% {
        transform: scale(1);
        border-color: var(--success-color);
    }
}

/* Focus states for accessibility */
.saiap-step:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .saiap-step.completed {
        border-width: 3px;
    }
    
    .saiap-step.incomplete {
        border-width: 2px;
        border-color: #000000;
    }
    
    .saiap-step-indicator {
        border: 2px solid currentColor;
    }
}

/* =============================================================================
   Trial-Aware Onboarding Styles
   ============================================================================= */

/* Trial upgrade onboarding (compact banner for users with API keys) */
.saiap-trial-upgrade-onboarding .saiap-onboarding-header--compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    text-align: left;
}

.saiap-trial-upgrade-onboarding .saiap-onboarding-header__content {
    flex: 1;
}

.saiap-trial-upgrade-onboarding .saiap-onboarding-header__content h3 {
    margin-bottom: 4px;
    font-size: 18px;
}

.saiap-trial-upgrade-onboarding .saiap-onboarding-header__action {
    flex-shrink: 0;
}

.saiap-trial-upgrade-onboarding .saiap-onboarding-header__action .button {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .saiap-trial-upgrade-onboarding .saiap-onboarding-header--compact {
        flex-direction: column;
        text-align: center;
    }
    
    .saiap-trial-upgrade-onboarding .saiap-onboarding-header__content {
        text-align: center;
    }
}

/* Trial progress onboarding (horizontal steps for active trial) */
.saiap-trial-progress-onboarding .saiap-onboarding-trial-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.saiap-trial-progress-onboarding .saiap-onboarding-header h3 {
    margin-bottom: 12px;
}

.saiap-trial-progress-onboarding .saiap-onboarding-progress {
    margin-bottom: 20px;
}

/* Horizontal steps layout for trial progress */
.saiap-onboarding-steps--horizontal {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 12px;
}

.saiap-onboarding-steps--horizontal .saiap-step {
    flex: 1;
    max-width: 220px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px;
}

.saiap-onboarding-steps--horizontal .saiap-step-indicator {
    margin-bottom: 8px;
}

.saiap-onboarding-steps--horizontal .saiap-step-content h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.saiap-onboarding-steps--horizontal .saiap-step-content p {
    font-size: 12px;
    margin-bottom: 6px;
}

.saiap-onboarding-steps--horizontal .saiap-step-link {
    font-size: 13px;
}

.saiap-onboarding-steps--horizontal .saiap-step-status {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

/* Spinner inside step indicator */
.saiap-step-spinner.spinner {
    float: none;
    margin: 0;
    background-size: 20px 20px;
}

@media (max-width: 768px) {
    .saiap-onboarding-steps--horizontal {
        flex-direction: column;
    }
    
    .saiap-onboarding-steps--horizontal .saiap-step {
        max-width: 100%;
        flex-direction: row;
        text-align: left;
    }
    
    .saiap-onboarding-steps--horizontal .saiap-step-indicator {
        margin-bottom: 0;
    }
}

/* Trial-first onboarding: Make "Start Free Trial" button more prominent */
.saiap-trial-onboarding .saiap-step.incomplete:first-child {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f0f4ff 0%, #e6ebff 100%);
}

.saiap-trial-onboarding .saiap-step.incomplete:first-child .saiap-step-indicator {
    background-color: var(--primary-color);
    color: #ffffff;
}

.saiap-trial-onboarding .saiap-step-primary-action.saiap-start-trial-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.saiap-trial-onboarding .saiap-step-primary-action.saiap-start-trial-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}