/* Minimal layout overrides — neutralize Veltrix chrome when sidebar/topbar
   are suppressed by $data['minimal_layout'] so the onboarding card sits
   centered in the viewport without left padding reserved for the sidebar. */
body.minimal-layout .main-content { margin-left: 0; }
body.minimal-layout .page-content { padding: 0; }
body.minimal-layout #layout-wrapper { background: #f5f6f8; min-height: 100vh; }

/* Onboarding Wizard */
.onboarding-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 70vh;
    padding: 40px 16px;
}

.onboarding-card {
    width: 100%;
    max-width: 640px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    padding: 40px;
}

/* Progress bar */
.onboarding-progress {
    display: flex;
    gap: 6px;
    margin-bottom: 32px;
}

.onboarding-progress .progress-segment {
    flex: 1;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.onboarding-progress .progress-segment.active {
    background: #556ee6;
}

.onboarding-progress .progress-segment.completed {
    background: #34c38f;
}

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

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

.onboarding-step h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #343a40;
}

.onboarding-step .step-subtitle {
    color: #74788d;
    margin-bottom: 28px;
    font-size: 15px;
}

/* Selectable option cards */
.option-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.option-card {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px 16px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    background: #fff;
    user-select: none;
}

.option-card:hover {
    border-color: #556ee6;
    background: #f8f9ff;
}

.option-card.selected {
    border-color: #556ee6;
    background: #f0f3ff;
}

.option-card .option-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

.option-card .option-label {
    font-weight: 600;
    font-size: 14px;
    color: #343a40;
    display: block;
}

.option-card .option-desc {
    font-size: 12px;
    color: #74788d;
    margin-top: 4px;
    display: block;
}

/* Multi-select cards have a checkbox indicator */
.option-card.multi-select .check-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid #ced4da;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.option-card.multi-select.selected .check-indicator {
    border-color: #556ee6;
    background: #556ee6;
}

.option-card.multi-select.selected .check-indicator::after {
    content: '\2713';
    color: #fff;
    font-size: 14px;
    position: absolute;
    top: -2px;
    left: 2px;
}

/* Connect Meta section */
.connect-meta-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.connect-meta-buttons .btn {
    padding: 14px 20px;
    font-size: 15px;
    border-radius: 8px;
}

.meta-connected-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #d4edda;
    color: #155724;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    margin-bottom: 16px;
}

/* Page/Form select step */
.onboarding-select-group {
    margin-bottom: 20px;
}

.onboarding-select-group label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    color: #343a40;
}

.onboarding-select-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s;
}

.onboarding-select-group select:focus {
    border-color: #556ee6;
    outline: none;
}

/* Email input */
.onboarding-email-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.onboarding-email-input:focus {
    border-color: #556ee6;
    outline: none;
}

/* Completion summary */
.completion-summary {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.completion-summary .summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.completion-summary .summary-item:last-child {
    border-bottom: none;
}

.completion-summary .summary-check {
    color: #34c38f;
    font-size: 18px;
}

/* Action buttons */
.onboarding-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
}

.onboarding-actions .btn-primary {
    padding: 10px 28px;
    border-radius: 8px;
    font-weight: 500;
}

.onboarding-actions .btn-skip {
    color: #74788d;
    text-decoration: none;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
}

.onboarding-actions .btn-skip:hover {
    color: #343a40;
}

.onboarding-actions .btn-back {
    color: #74788d;
    text-decoration: none;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 0;
}

.onboarding-actions .btn-back:hover {
    color: #343a40;
}

/* Loading spinner for AJAX */
.onboarding-loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.onboarding-loading.show {
    display: block;
}

/* Step 5: Destination picker */
.dest-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.dest-card {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
    user-select: none;
}

.dest-card:hover {
    border-color: #556ee6;
    background: #f8f9ff;
}

.dest-card.selected {
    border-color: #556ee6;
    background: #f0f3ff;
}

.dest-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.dest-name {
    font-size: 13px;
    font-weight: 500;
    color: #343a40;
    line-height: 1.2;
}

.dest-toggle {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: #556ee6;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 8px;
    text-align: center;
}

.dest-toggle:hover {
    color: #3b4cc0;
}

.dest-toggle i {
    font-size: 11px;
    margin-left: 4px;
    transition: transform 0.2s;
}

.dest-toggle.expanded i {
    transform: rotate(180deg);
}

.dest-all-wrapper {
    border-top: 1px solid #e9ecef;
    padding-top: 16px;
    margin-bottom: 8px;
}

.dest-category {
    margin-bottom: 16px;
}

.dest-category-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #74788d;
    margin-bottom: 8px;
}

.dest-setup-note {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0faf5;
    border: 1px solid #c3e6d5;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    color: #343a40;
    margin-top: 16px;
}

/* Non-meta skip note */
.skip-note {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 12px 16px;
    color: #856404;
    font-size: 14px;
    margin-top: 16px;
}

/* Step 1: Source picker tiles (2x2) — replaces the Meta-only hero CTA. */
.source-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 8px;
}

.source-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px 16px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
    min-height: 140px;
    user-select: none;
    font: inherit;
    color: inherit;
}

.source-tile:hover {
    border-color: #556ee6;
    background: #f8f9ff;
}

.source-tile:focus {
    outline: 2px solid #556ee6;
    outline-offset: 2px;
}

.source-tile.selected {
    border-color: #556ee6;
    background: #f0f3ff;
}

.source-tile-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-bottom: 10px;
}

.source-tile-name {
    font-weight: 600;
    font-size: 15px;
    color: #343a40;
    line-height: 1.2;
    margin-bottom: 4px;
}

.source-tile-desc {
    font-size: 12px;
    color: #74788d;
    line-height: 1.3;
}

/* Meta chooser: personal vs Business Manager OAuth (Trello #1495). */
.meta-chooser {
    margin-top: 8px;
    padding: 24px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
}

.meta-chooser h4 {
    font-size: 18px;
    font-weight: 600;
    color: #343a40;
    margin-bottom: 16px;
}

.meta-chooser-hint {
    font-size: 14px;
    color: #b54708;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.meta-choice {
    display: block;
    width: 100%;
    text-align: left;
    padding: 16px 18px;
    margin-bottom: 12px;
    background: #fff;
    border: 2px solid #556ee6;
    border-radius: 10px;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.meta-choice:hover,
.meta-choice:focus {
    box-shadow: 0 4px 14px rgba(85, 110, 230, 0.18);
    outline: none;
}

.meta-choice-secondary {
    border-color: #dee2e6;
}

.meta-choice-secondary:hover,
.meta-choice-secondary:focus {
    border-color: #adb5bd;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.meta-choice-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #343a40;
    margin-bottom: 4px;
}

.meta-choice-desc {
    display: block;
    font-size: 13px;
    color: #74788d;
    line-height: 1.4;
}

/* Inline Google Ads setup panel (no OAuth — webhook URL + KEY pasted into
   Google Ads Lead Form Extension). */
.google-setup-panel {
    margin-top: 8px;
    padding: 24px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
}

.google-setup-panel h4 {
    font-size: 18px;
    font-weight: 600;
    color: #343a40;
    margin-bottom: 8px;
}

.google-setup-panel > p {
    font-size: 14px;
    color: #74788d;
    margin-bottom: 20px;
}

.webhook-display {
    margin-bottom: 16px;
}

.webhook-display label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #343a40;
    margin-bottom: 6px;
}

.webhook-value-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 12px;
}

.webhook-value-row code {
    flex: 1;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 13px;
    color: #343a40;
    background: transparent;
    padding: 0;
    /* Prevent code from being selected by accident on copy-button click */
    user-select: all;
}

.webhook-value-row .btn {
    flex-shrink: 0;
}

.google-setup-links {
    margin-bottom: 4px;
}

.google-setup-links .btn {
    margin-right: 4px;
}

/* Mobile responsive */
@media (max-width: 576px) {
    .onboarding-card {
        padding: 24px 20px;
    }

    .option-cards {
        grid-template-columns: 1fr;
    }

    .dest-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .onboarding-step h2 {
        font-size: 20px;
    }

    .onboarding-actions {
        flex-direction: column-reverse;
        gap: 12px;
    }

    .onboarding-actions .btn-primary {
        width: 100%;
    }

    /* Source tiles collapse to 2x2 still works at narrow widths;
       only collapse to single column at very small viewports. */
    .source-tiles {
        gap: 8px;
    }

    .source-tile {
        padding: 16px 10px;
        min-height: 120px;
    }

    .source-tile-icon {
        width: 32px;
        height: 32px;
    }

    .google-setup-panel {
        padding: 18px 16px;
    }
}

@media (max-width: 380px) {
    .source-tiles {
        grid-template-columns: 1fr;
    }
}
