.tab-content {
    padding: 20px;
    /* background: #fff; */
    border: 1px solid #ccd0d4;
    border-top: none;
}
.sync-background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2); /* Light transparent overlay */
    z-index: 9998; /* Lower than the loader */
    display: none;
}

.sync-loader {
    position: fixed; /* or absolute */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

.sync-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 10000;
    display: flex; /* Ensure it centers content */
}

.sync-modal {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 300px;
    animation: fadeIn 0.3s ease-in-out;
}


/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Input Group styling */
.ansera-search-input-group {
    display: block; /* Changed from flex to block for vertical stacking */
    margin-bottom: 1.5rem;
}

/* Multi-row video input styling */
#ansera-search-video-rows {
    margin-bottom: 1rem;
}

.ansera-search-video-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.ansera-search-video-row:last-child {
    margin-bottom: 0;
}

.ansera-search-videoLinkInput,
.ansera-search-videoTitleInput {
    flex: 1;
    border: 1px solid #8c8f94;
    box-shadow: 0 0 0 transparent;
    padding: 0.5rem 0.75rem;
    font-size: 14px;
    outline: none;
    transition: border-color 0.1s;
    border-radius: 3px;
}

.ansera-search-videoLinkInput:focus,
.ansera-search-videoTitleInput:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    position: relative;
    z-index: 1;
}

/* URL Validation Styles */
.ansera-search-videoLinkInput.valid-url {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 1px #28a745 !important;
    background-color: #f8fff9;
}

.ansera-search-videoLinkInput.valid-url:focus {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 1px #28a745 !important;
}

.ansera-search-videoLinkInput.invalid-url {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 1px #dc3545 !important;
    background-color: #fff8f8;
}

.ansera-search-videoLinkInput.invalid-url:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 1px #dc3545 !important;
}

.ansera-search-add-row-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #8c8f94;
    background: #fff;
    color: #2271b1;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ansera-search-add-row-btn:hover {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.ansera-search-add-row-btn:disabled {
    background: #f0f0f1;
    color: #8c8f94;
    border-color: #ddd;
    cursor: not-allowed;
}

.ansera-search-remove-row-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #dc3545;
    background: #fff;
    color: #dc3545;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ansera-search-remove-row-btn:hover {
    background: #dc3545;
    color: #fff;
}

/* Style for both input fields (legacy support) */
#ansera-search-videoLinkInput,
#ansera-search-videoTitleInput {
    width: 100%; /* Make inputs full width */
    display: block; /* Ensure they are block-level elements */
    border: 1px solid #8c8f94;
    box-shadow: 0 0 0 transparent;
    padding: 0.5rem 0.75rem;
    font-size: 14px;
    outline: none;
    transition: border-color 0.1s;
    border-radius: 3px; /* Apply standard border-radius */
    margin-bottom: 0.75rem; /* Add space below each input */
}

#ansera-search-videoLinkInput:focus,
#ansera-search-videoTitleInput:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    position: relative;
    z-index: 1;
}

#ansera-search-addLinkBtn {
    width: auto; /* Allow button to size to its content */
    display: inline-block;
    text-decoration: none;
    font-size: 13px;
    line-height: 2.15;
    min-height: 30px;
    margin: 0;
    padding: 0 12px;
    cursor: pointer;
    border-width: 1px;
    border-style: solid;
    border-radius: 3px; /* Apply standard border-radius */
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    vertical-align: top;
}
#ansera-search-addLinkBtn:hover, #ansera-search-addLinkBtn:focus {
    background: #135e96;
    border-color: #135e96;
}

#ansera-search-addLinkBtn:disabled {
    background: #8c8f94;
    border-color: #8c8f94;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Trigger Sync Button */
#ansera-search-triggerSyncBtn {
    width: auto;
    display: inline-block;
    text-decoration: none;
    font-size: 13px;
    line-height: 2.15;
    min-height: 30px;
    margin: 0 0 0 10px;
    padding: 0 12px;
    cursor: pointer;
    border-width: 1px;
    border-style: solid;
    border-radius: 3px;
    background: #6c757d;
    border-color: #6c757d;
    color: #fff;
    vertical-align: top;
}

#ansera-search-triggerSyncBtn:hover, #ansera-search-triggerSyncBtn:focus {
    background: #5a6268;
    border-color: #5a6268;
}

#ansera-search-triggerSyncBtn:disabled {
    background: #8c8f94;
    border-color: #8c8f94;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Add Link Spinner */
.ansera-add-link-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: ansera-spin 1s linear infinite;
}

/* Retry Button Spinner */
.ansera-retry-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 6px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #dc3545;
    border-radius: 50%;
    animation: ansera-spin 1s linear infinite;
}

@keyframes ansera-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message display styling */
.ansera-search-message {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    display: inline-block;
    animation: fadeInOut 5s ease-in-out;
}

.ansera-search-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ansera-search-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-10px); }
    10% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Manual sync button message styles */
#ansera-manual-sync-message {
    display: inline-block;
    margin-left: 15px;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#ansera-manual-sync-message.loading {
    color: #2271b1;
    background-color: #e7f3ff;
    border: 1px solid #b3d9ff;
}

#ansera-manual-sync-message.success {
    color: #28a745;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

#ansera-manual-sync-message.error {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

/* Ensure button stays in place and message doesn't affect layout */
#ansera-manual-sync-btn {
    position: relative;
    z-index: 1;
    width: auto;
    display: inline-block;
    text-decoration: none;
    font-size: 13px;
    line-height: 2.15;
    min-height: 30px;
    margin: 0;
    padding: 0 12px;
    cursor: pointer;
    border-width: 1px;
    border-style: solid;
    border-radius: 3px;
    background: #6c757d;
    border-color: #6c757d;
    color: #fff;
    vertical-align: top;
}

#ansera-manual-sync-btn:hover, #ansera-manual-sync-btn:focus {
    background: #5a6268;
    border-color: #5a6268;
}

#ansera-manual-sync-btn:disabled {
    background: #8c8f94;
    border-color: #8c8f94;
    cursor: not-allowed;
    opacity: 0.6;
}

#regenerate-ansera-questions {
    position: relative;
    z-index: 1;
    width: auto;
    display: inline-block;
    text-decoration: none;
    font-size: 13px;
    line-height: 2.15;
    min-height: 30px;
    margin: 0;
    padding: 0 12px;
    cursor: pointer;
    border-width: 1px;
    border-style: solid;
    border-radius: 3px;
    background: #6c757d;
    border-color: #6c757d;
    color: #fff;
    vertical-align: top;
}

#regenerate-ansera-questions:hover, #regenerate-ansera-questions:focus {
    background: #5a6268;
    border-color: #5a6268;
}

#regenerate-ansera-questions:disabled {
    background: #8c8f94;
    border-color: #8c8f94;
    cursor: not-allowed;
    opacity: 0.6;
}

#ansera-manual-sync-message {
    position: relative;
    z-index: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* --- Video Links Table Styling --- */


.ansera-search-container #ansera-search-linkTable { 
    width: 100% !important; 
    border-collapse: collapse; 
    border: 1px solid #c3c4c7; 
    background: #fff; 
    margin-top: 1.5rem;
}
.ansera-search-container #ansera-search-linkTable th, 
.ansera-search-container #ansera-search-linkTable td { 
    padding: 10px; 
    text-align: left; 
    word-break: break-all; 
}
.ansera-search-container #ansera-search-linkTable td { 
    border-top: 1px solid #c3c4c7; 
    font-size: 13px; 
}
.ansera-search-container #ansera-search-linkTable thead th { 
    background-color: #f0f0f1; 
    font-weight: 600; 
    color: #2c3338; 
    font-size: 14px; 
    border-bottom: 1px solid #c3c4c7; 
}

/* DataTables Customization - Scoped to container */
.ansera-search-container #ansera-search-linkTable.dataTable {
    border: 1px solid #c3c4c7;
    background: white;
}

.ansera-search-container #ansera-search-linkTable.dataTable thead th {
    background-color: #f0f0f1;
    font-weight: 600;
    color: #2c3338;
    border-bottom: 2px solid #c3c4c7;
    padding: 12px 8px;
}

.ansera-search-container #ansera-search-linkTable.dataTable tbody td {
    padding: 12px 8px;
    border-bottom: 1px solid #c3c4c7;
    vertical-align: middle;
    font-size: 13px;
}

.ansera-search-container #ansera-search-linkTable.dataTable tbody tr:hover {
    background-color: #f6f7f7;
}

/* DataTables Controls Styling - Scoped to container */
.ansera-search-container .dataTables_wrapper .dataTables_length,
.ansera-search-container .dataTables_wrapper .dataTables_filter,
.ansera-search-container .dataTables_wrapper .dataTables_info,
.ansera-search-container .dataTables_wrapper .dataTables_paginate {
    margin: 15px 0;
    font-size: 14px;
}

/* Fix spacing between length selector and pagination - Scoped to container */
.ansera-search-container .dataTables_wrapper .dataTables_length {
    float: left;
    margin-right: 20px;
}

.ansera-search-container .dataTables_wrapper .dataTables_filter {
    float: right;
    margin-left: 20px;
}

.ansera-search-container .dataTables_wrapper .dataTables_info {
    clear: both;
    float: left;
    margin-top: 10px;
}

.ansera-search-container .dataTables_wrapper .dataTables_paginate {
    clear: both;
    float: right;
    margin-top: 10px;
}

.ansera-search-container .dataTables_wrapper .dataTables_filter input {
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    padding: 6px 8px;
    margin-left: 8px;
    box-shadow: 0 0 0 transparent;
}

.ansera-search-container .dataTables_wrapper .dataTables_filter input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.ansera-search-container .dataTables_wrapper .dataTables_length select {
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    padding: 4px 8px;
    margin: 0 4px;
    box-shadow: 0 0 0 transparent;
    width: 60px;
}

.ansera-search-container .dataTables_wrapper .dataTables_length select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.ansera-search-container .dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 6px 12px;
    margin: 0 2px;
    border: 1px solid #c3c4c7;
    background: #f0f0f1;
    color: #2c3338;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
}

.ansera-search-container .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #e5e5e5;
    border-color: #8c8f94;
    color: #2c3338;
}

.ansera-search-container .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #2271b1;
    color: white;
    border-color: #2271b1;
}

.ansera-search-container .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    color: #8c8f94;
    cursor: not-allowed;
    background: #f0f0f1;
}

/* Retry button styling */
.ansera-search-retry-sync {
    margin-left: 8px;
    padding: 4px 8px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
}

.ansera-search-retry-sync:hover {
    background-color: #c82333;
    color: white;
    text-decoration: none;
}

.ansera-search-retry-sync:disabled {
    background-color: #8c8f94;
    border-color: #8c8f94;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Unsync button styling */
.ansera-search-unsync-video {
    margin-left: 8px;
    padding: 4px 8px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
}

.ansera-search-unsync-video:hover {
    background-color: #c82333;
    color: white;
    text-decoration: none;
}

.ansera-search-unsync-video:disabled {
    background-color: #8c8f94;
    border-color: #8c8f94;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Unsync spinner styling */
.ansera-unsync-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #dc3545;
    border-radius: 50%;
    animation: ansera-spin 1s linear infinite;
    margin-left: 5px;
}

/* Responsive DataTables - Scoped to container */
@media screen and (max-width: 767px) {
    .ansera_search_container .dataTables_wrapper .dataTables_length,
    .ansera_search_container .dataTables_wrapper .dataTables_filter {
        text-align: left;
        margin-bottom: 10px;
        float: none;
        margin-right: 0;
        margin-left: 0;
    }
    
    .ansera_search_container .dataTables_wrapper .dataTables_info,
    .ansera_search_container .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        margin-top: 10px;
        float: none;
    }
}

/* Additional spacing fixes - Scoped to container */
.ansera_search_container .dataTables_wrapper::after {
    content: "";
    display: table;
    clear: both;
}

.ansera_search_container .dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/*
 * Custom Color Palette Styles
 */
#ansera-custom-colors-row {
    /* background-color: #f9f9f9; */
    border-radius: 4px;
    padding: 15px;
    margin-top: 10px;
    /* border: 1px solid #e1e1e1; */
}

#ansera-custom-colors-row input[type="color"] {
    cursor: pointer;
    border: 2px solid #ddd;
    transition: border-color 0.3s ease;
    border-radius: 4px;
    padding: 0;
    width: 100px;
    height: 40px;
}

#ansera-custom-colors-row input[type="color"]:hover {
    border-color: #0073aa;
}

#ansera-custom-colors-row input[type="color"]:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

#ansera-custom-colors-row label {
    color: #333;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

#ansera-custom-colors-row .color-preview {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin-left: 10px;
    border: 1px solid #ddd;
    vertical-align: middle;
}

/* Grid layout for color pickers */
#ansera-custom-colors-row .color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 10px;
}

#ansera-custom-colors-row .color-item {
    display: flex;
    flex-direction: column;
}

#ansera-custom-colors-row .color-item .color-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

#ansera-custom-colors-row .color-item .color-value {
    font-size: 12px;
    color: #666;
    font-family: monospace;
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
    min-width: 70px;
    text-align: center;
}

/* New styling for color value input fields */
#ansera-custom-colors-row .color-item .color-value-input {
    font-size: 12px;
    color: #666;
    font-family: monospace;
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
    min-width: 70px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s ease;
}

#ansera-custom-colors-row .color-item .color-value-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

#ansera-custom-colors-row .color-item .color-value-input:invalid,
#ansera-custom-colors-row .color-item .color-value-input.invalid {
    border-color: #d63638;
    box-shadow: 0 0 0 1px #d63638;
}

/* Preview section styling */
#ansera-custom-colors-row .color-preview-section {
    margin-top: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #0073aa;
}

#ansera-custom-colors-row .color-preview-section small {
    color: #666;
    line-height: 1.4;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    #ansera-custom-colors-row .color-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    #ansera-custom-colors-row input[type="color"] {
        width: 80px;
        height: 35px;
    }
}

/* Chat Widget Colors Section - Apply same styling as custom colors */
.ansera-custom-colors-textbox-row .color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 10px;
}

.ansera-custom-colors-textbox-row .color-item {
    display: flex;
    flex-direction: column;
}

.ansera-custom-colors-textbox-row .color-item .color-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ansera-custom-colors-textbox-row .color-item label {
    color: #333;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.ansera-custom-colors-textbox-row .color-item input[type="color"] {
    cursor: pointer;
    border: 2px solid #ddd;
    transition: border-color 0.3s ease;
    border-radius: 4px;
    padding: 0;
    width: 100px;
    height: 40px;
}

.ansera-custom-colors-textbox-row .color-item input[type="color"]:hover {
    border-color: #0073aa;
}

.ansera-custom-colors-textbox-row .color-item input[type="color"]:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

.ansera-custom-colors-textbox-row .color-item .color-value-input {
    font-size: 12px;
    color: #666;
    font-family: monospace;
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
    min-width: 70px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s ease;
}

.ansera-custom-colors-textbox-row .color-item .color-value-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.ansera-custom-colors-textbox-row .color-item .color-value-input:invalid,
.ansera-custom-colors-textbox-row .color-item .color-value-input.invalid {
    border-color: #d63638;
    box-shadow: 0 0 0 1px #d63638;
}

.ansera-wp-plugin-help-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin-left: 5px;
    vertical-align: middle;
}

/* Tooltip Text styling */
.ansera-wp-plugin-tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #32373c; /* Native WP dark grey */
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%; /* Position above icon */
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
}

/* Show tooltip on hover */
.ansera-wp-plugin-help-container:hover .ansera-wp-plugin-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Responsive design for Chat Widget Colors */
@media (max-width: 768px) {
    .ansera-custom-colors-textbox-row .color-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ansera-custom-colors-textbox-row .color-item input[type="color"] {
        width: 80px;
        height: 35px;
    }
}
