.contacts-onboarding-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.2s ease;
    overflow-y: auto;
    padding: 20px 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.contacts-onboarding-content {
    position: relative;
    background-color: #fff;
    margin: 0 auto;
    padding: 0;
    width: 90%;
    max-width: 980px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.contacts-onboarding-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 32px;
    font-weight: 300;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 1;
}

.contacts-onboarding-close:hover {
    color: #333;
    background-color: #f5f5f5;
}

.contacts-onboarding-content h2 {
    margin: 0;
    padding: 24px 30px;
    border-bottom: 2px solid #f0f0f0;
    font-size: 26px;
    font-weight: 600;
    color: #2c3e50;
    flex-shrink: 0;
}

.contacts-onboarding-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.contacts-step {
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.contacts-step p {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin: 12px 0;
    max-width: 500px;
}

.contacts-step p:last-child {
    font-size: 14px;
    color: #999;
}

.contacts-step p.contacts-intro-note {
    font-size: 13px;
    color: #5a6675;
    background: #f5f8fc;
    border: 1px solid #dce6f2;
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 8px;
    max-width: 640px;
}

.contacts-actions {
    margin-top: 24px;
}

.contacts-btn {
    padding: 14px 28px;
    margin: 10px 8px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-width: 140px;
}

.contacts-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.contacts-btn:active {
    transform: translateY(0);
}

.contacts-btn-primary {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #fff;
}

.contacts-btn-primary:hover {
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
}

.contacts-btn-secondary {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.contacts-btn-secondary:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.contacts-loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.contacts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.contacts-header p {
    margin: 0;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.contacts-source-status {
    margin: 0 0 10px 0;
    font-size: 12px;
    line-height: 1.4;
    color: #46515f;
}

.contacts-source-status.ok {
    color: #1d4f2a;
}

.contacts-source-status.warn {
    color: #7a4f01;
}

.contacts-list {
    min-height: 460px;
    max-height: min(68vh, 760px);
    overflow-y: auto;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 16px;
    background-color: #fff;
}

.contacts-toolbar {
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px;
    background: #fcfdff;
}

.contacts-toolbar-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px 145px;
    gap: 8px;
    margin-bottom: 8px;
}

.contacts-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.contacts-control-input {
    min-width: 0;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
}

.contacts-control-select {
    padding: 8px 8px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    min-height: 36px;
}

.contacts-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

.contacts-mini-btn {
    min-width: auto;
    padding: 7px 10px;
    margin: 0;
    font-size: 12px;
    box-shadow: none;
}

.contacts-list::-webkit-scrollbar {
    width: 8px;
}

.contacts-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.contacts-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.contacts-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.contacts-item {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

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

.contacts-item:hover {
    background-color: #f8f9fa;
}

.contacts-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 10px;
    flex-wrap: wrap;
}

.contacts-checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.contact-name {
    flex: 1 1 180px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.contact-email {
    font-size: 12px;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 3px 8px;
}

.contact-phone {
    color: #6c757d;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.contact-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: #eef2f7;
    color: #495057;
    border: 1px solid #dbe2ea;
}

.contact-badge-personal {
    background: #e6f8ee;
    color: #156f42;
    border: 1px solid #b9e6ca;
}

.contact-badge-source {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #d6dee8;
}

.contacts-personal-row {
    margin-left: 30px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #495057;
}

.contacts-missing-name-note {
    color: #b26a00;
    font-size: 12px;
}

.contacts-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-top: 8px;
    flex-wrap: wrap;
}

.contacts-empty {
    padding: 60px 20px;
    color: #6c757d;
    font-style: italic;
    font-size: 15px;
    text-align: center;
}

.contacts-list-truncated {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-top: 1px solid #e9ecef;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
}

.contacts-success-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #46b450 0%, #3a9943 100%);
    color: #fff;
    font-size: 54px;
    line-height: 90px;
    margin: 30px auto 20px;
    box-shadow: 0 4px 12px rgba(70, 180, 80, 0.3);
}

.contacts-error-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    font-size: 54px;
    line-height: 90px;
    margin: 30px auto 20px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

#contacts-step-complete h3 {
    color: #46b450;
    margin: 16px 0;
    font-size: 24px;
    font-weight: 600;
}

#contacts-step-error h3 {
    color: #d97706;
    margin: 16px 0;
    font-size: 24px;
    font-weight: 600;
}

#contacts-result-message {
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    margin: 20px 0;
    max-width: 450px;
}

/* Step-specific styling */
#contacts-step-select {
    text-align: left;
    min-height: auto;
    justify-content: flex-start;
    align-items: stretch;
    width: 100%;
}

#contacts-step-select .contacts-header p {
    display: flex;
    align-items: center;
    gap: 8px;
}

#contacts-step-select .contacts-header,
#contacts-step-select .contacts-source-status,
#contacts-step-select .contacts-toolbar,
#contacts-step-select .contacts-list,
#contacts-step-select .contacts-actions {
    width: 100%;
    max-width: none;
}

#contacts-count {
    display: inline-block;
    background-color: #0073aa;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
}

.activation-toggles-container {
    margin-bottom: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    text-align: left;
}

.activation-toggles-container h3 {
    margin: 0 0 14px;
    font-size: 18px;
    color: var(--rh-wizard-text, #2f3440);
    text-align: center;
}

.toggle-option {
    margin-bottom: 12px;
    padding: 12px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: border-color 0.25s ease, opacity 0.25s ease, background-color 0.25s ease;
}

.toggle-option.is-active {
    border-color: color-mix(in srgb, var(--rh-wizard-success, #8a94a6) 70%, #ffffff 30%);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--rh-wizard-success, #8a94a6) 18%, transparent);
}

.toggle-option[data-feature="ai"].is-disabled {
    opacity: 0.6;
    background: #f5f5f5;
}

.activation-option-label {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    user-select: none;
}

.activation-copy {
    display: block;
    flex: 1;
}

.activation-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--rh-wizard-text, #2f3440);
    margin-bottom: 4px;
}

.activation-description {
    display: block;
    font-size: 13px;
    color: var(--rh-wizard-muted, #6b7280);
    line-height: 1.4;
}

.activation-toggle-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    border-radius: 14px;
    background: #c9ced4;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.toggle-switch.is-active {
    background: var(--rh-wizard-success, #8a94a6);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s ease;
}

.toggle-switch.is-active .toggle-slider {
    transform: translateX(24px);
}

.activation-tip {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff8e5;
    color: #7a6a22;
    font-size: 12px;
    text-align: center;
}

.qr-activate-bot-btn {
    width: 100%;
    max-width: 400px;
    padding: 16px 20px;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

@media (max-width: 768px) {
    .contacts-onboarding-modal {
        padding: 10px 0;
    }
    
    .contacts-onboarding-content {
        width: 95%;
        max-height: calc(100vh - 20px);
        border-radius: 8px;
    }
    
    .contacts-onboarding-content h2 {
        font-size: 22px;
        padding: 20px 20px;
    }
    
    .contacts-onboarding-body {
        padding: 20px;
    }
    
    .contacts-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 12px;
    }

    .contacts-toolbar-main {
        grid-template-columns: 1fr;
    }

    .contacts-control-input {
        width: 100%;
    }

    .contacts-control-select {
        width: 100%;
    }

    .contacts-toolbar-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .contacts-personal-row {
        margin-left: 0;
    }
    
    .contacts-list {
        min-height: 300px;
        max-height: 52vh;
    }
    
    .contacts-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .contacts-btn {
        width: 100%;
        margin: 6px 0;
    }
    
    .contact-name {
        font-size: 14px;
    }
    
    .contact-phone {
        font-size: 12px;
    }

    .activation-toggles-container {
        padding: 16px;
    }

    .activation-option-label {
        align-items: flex-start;
    }

    .activation-title {
        font-size: 15px;
    }

    .activation-description {
        font-size: 12px;
    }

    .qr-activate-bot-btn {
        max-width: 100%;
        font-size: 15px;
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .contacts-onboarding-content h2 {
        font-size: 20px;
        padding: 18px 16px;
    }
    
    .contacts-onboarding-close {
        right: 12px;
        top: 16px;
        font-size: 28px;
    }
}
