/* Global Addon Admin Styles */

/* Main Layout */
.smart-addons-admin .wp-heading-inline {
    margin-bottom: 10px;
}

.smart-addons-content {
    background: #fff;
    padding: 20px;
    margin-top: 10px;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.smart-addons-section {
    margin-bottom: 30px;
}

.smart-addons-section:last-child {
    margin-bottom: 0;
}

.smart-addons-section h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.smart-addons-section h3 {
    margin-top: 25px;
    margin-bottom: 15px;
}

/* Navigation Tabs */
.nav-tab-wrapper .nav-tab .dashicons {
    font-size: 16px;
    vertical-align: text-bottom;
    margin-right: 5px;
}

/* Table Styles */
.smart-addons-admin .wp-list-table {
    margin-top: 15px;
}

.smart-addons-admin .column-priority,
.smart-addons-admin .column-type {
    width: 100px;
}

.smart-addons-admin .column-status {
    width: 120px;
}

.smart-addons-admin .column-assignments,
.smart-addons-admin .column-display,
.smart-addons-admin .column-addons {
    width: 120px;
}

.smart-addons-admin .column-actions {
    width: 150px;
}

/* Priority Editing */
.priority-value {
    position: relative;
}

.priority-input {
    width: 60px;
}

/* Priority Auto-save Feedback */
.priority-value {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.priority-input {
    width: 55px !important;
    text-align: center;
}

.priority-input.saving {
    opacity: 0.7;
    pointer-events: none;
}

.priority-feedback {
    display: inline-flex;
    align-items: center;
    min-width: 20px;
}

.priority-feedback .spinner {
    width: 16px;
    height: 16px;
    background-size: 16px 16px;
}

/* Status and Type Badges */
.addon-status,
.addon-type,
.display-style {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

/* Status Colors */
.status-active {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-inactive {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Type Colors */
.addon-type-global_addon {
    background: #e1f5fe;
    color: #01579b;
}

/* Display Style Colors */
.display-style {
    text-transform: none;
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.display-style .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1;
}

.display-style-checkbox {
    background: #f1f1f1;
    color: #555;
}

.display-style-radio {
    background: #fff3e0;
    color: #e65100;
}

.display-style-dropdown {
    background: #e8f5e8;
    color: #2e7d32;
}

.display-style-swatch {
    background: #fce4ec;
    color: #880e4f;
}

.display-style-image {
    background: #f3e5f5;
    color: #4a148c;
}

/* Rules Summary (Assignments + Exclusions) */
.rules-summary {
    margin-bottom: 4px;
}

.rules-summary a {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.rules-summary .rule-type-badge {
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rules-summary .rule-count {
    color: #646970;
    font-size: 11px;
    font-weight: normal;
}

.exclusions-summary {
    margin-top: 3px;
}

.exclusion-badge {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

.no-assignments {
    color: #a7aaad;
    font-style: italic;
    font-size: 12px;
}

/* Rules column: left-align "No assignments" to match header */
.smart-addons-admin .column-assignments .no-assignments {
    text-align: left;
    padding: 0;
}

a.no-rules {
    text-decoration: none;
}

a.no-rules:hover .no-assignments {
    color: #2271b1;
}

.view-assignments {
    color: #0073aa;
    text-decoration: none;
}

.view-assignments:hover {
    color: #005177;
}

/* Modal Styles */
.global-addon-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.global-addon-modal .modal-content {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 90%;
    max-height: 88vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.global-addon-modal .modal-header {
    padding: 22px 28px;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2271b1 100%);
    flex-shrink: 0;
}

.global-addon-modal .modal-header h2,
.global-addon-modal .modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.01em;
}

.global-addon-modal .modal-close {
    background: rgba(255, 255, 255, 0.18) !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    cursor: pointer;
    color: #fff !important;
    padding: 0 !important;
    width: 32px !important;
    height: 32px !important;
    min-height: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 6px !important;
    transition: background 0.15s, transform 0.15s;
    line-height: 1;
    flex-shrink: 0;
    box-shadow: none !important;
}

.global-addon-modal .modal-close .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: #fff;
    line-height: 1;
}

.global-addon-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.32) !important;
    border-color: rgba(255, 255, 255, 0.55) !important;
    transform: scale(1.05);
}

.global-addon-modal .modal-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
    box-shadow: none !important;
}

.global-addon-modal .modal-body {
    padding: 24px 28px;
    flex: 1;
    overflow-y: auto;
}

.global-addon-modal .modal-footer {
    padding: 16px 28px;
    border-top: 1px solid #e8eaed;
    background: #f8f9fa;
    border-radius: 0 0 10px 10px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.global-addon-modal .modal-footer .button {
    margin-left: 10px;
}

/* Form Styles */
.smart-addons-section .form-table th {
    width: 200px;
    vertical-align: top;
    padding-top: 15px;
}

.smart-addons-section .form-table td {
    padding-top: 10px;
}

.assignment-form-wrapper,
.template-form-wrapper {
    margin: 20px 0;
}

.assignment-form-wrapper .postbox,
.template-form-wrapper .postbox {
    border: 1px solid #ccd0d4;
}

.assignment-form-wrapper .postbox h3,
.template-form-wrapper .postbox h3 {
    margin: 0;
    padding: 12px 20px;
    background: #f1f1f1;
    border-bottom: 1px solid #ccd0d4;
    font-size: 14px;
}

.assignment-form-wrapper .inside,
.template-form-wrapper .inside {
    padding: 20px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #555;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.spinner.is-active {
    float: none;
    margin: 20px auto;
    display: block;
}

/* Notice Styles */
.global-addon-notice {
    margin: 15px 0;
    padding: 10px 15px;
    border-left: 4px solid;
    background: #fff;
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
}

.global-addon-notice p {
    margin: 0;
}

.global-addon-notice.notice-success {
    border-left-color: #46b450;
    background: #f7fff7;
}

.global-addon-notice.notice-error {
    border-left-color: #dc3232;
    background: #fff7f7;
}

.global-addon-notice.notice-warning {
    border-left-color: #ffb900;
    background: #fffbf0;
}

.global-addon-notice.notice-info {
    border-left-color: #00a0d2;
    background: #f7fcff;
}

/* Enhanced Select Styles */
.select2-container {
    min-width: 300px;
}

.select2-container--default .select2-selection--multiple {
    min-height: 28px;
}

/* Import/Export Section */
.import-export-section {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.import-export-section h4 {
    margin-top: 0;
}

#import-options {
    margin-top: 15px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#import-options label {
    display: block;
    margin-bottom: 8px;
}

/* Statistics */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    text-align: center;
}

.stat-card .stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
    display: block;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    margin-top: 5px;
}

/* Tabbed Interface for Addon Rules Modal */
.modal-large .modal-content {
    max-width: 860px;
}

.addon-rules-tabs {
    margin-bottom: 20px;
    border-bottom: 2px solid #e8eaed;
}

.addon-rules-tabs .nav-tab-wrapper {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: none;
    gap: 4px;
}

.addon-rules-tabs .nav-tab {
    padding: 10px 22px 12px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    position: relative;
    border-radius: 0;
    font-size: 13px;
    font-weight: 500;
    color: #646970;
    transition: color 0.15s, border-color 0.15s;
}

.addon-rules-tabs .nav-tab:hover {
    color: #2271b1;
    background: transparent;
    border-bottom-color: #c3c4c7;
}

.addon-rules-tabs .nav-tab.nav-tab-active {
    color: #2271b1;
    border-bottom-color: #2271b1;
    background: transparent;
    font-weight: 600;
}

.addon-rules-tabs .tab-description {
    display: block;
    font-size: 11px;
    color: #a7aaad;
    font-weight: normal;
    margin-top: 2px;
}

.addon-rules-tabs .nav-tab.nav-tab-active .tab-description {
    color: #5b9bd5;
}

.tab-content-wrapper {
    background: #fff;
    padding: 0;
    border: none;
}

.tab-content {
    display: none !important;
}

.tab-content.active {
    display: block !important;
}

/* Rules List Styling (for both assignments and exclusions) */
.rules-section {
    margin-bottom: 24px;
}

.rules-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8eaed;
}

.rules-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 8px;
    background: #f8f9fa;
    scrollbar-width: thin;
    scrollbar-color: #c3c4c7 transparent;
}

.rules-list::-webkit-scrollbar {
    width: 5px;
}

.rules-list::-webkit-scrollbar-thumb {
    background: #c3c4c7;
    border-radius: 10px;
}

.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid #e8eaed;
    border-left: 4px solid #2271b1;
    border-radius: 6px;
    transition: box-shadow 0.15s, border-left-color 0.15s;
}

.rule-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.rule-item:last-child {
    margin-bottom: 0;
}

.rule-item.exclusion-item {
    border-left-color: #d63638;
}

.rule-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.rule-target {
    font-size: 13px;
    font-weight: 500;
    color: #1d2327;
}

.rule-type-badge {
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rule-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.rule-actions .button-small {
    height: 26px;
    line-height: 24px;
    font-size: 11px;
    padding: 0 8px;
    border-radius: 4px;
}

.rule-actions .button-link-delete {
    color: #b32d2e;
    border-color: #b32d2e;
    background: #fff;
}

.rule-actions .button-link-delete:hover {
    background: #fbdada;
    color: #8a2020;
}

.add-rule-section {
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 20px;
}

.add-rule-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rule-form {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.rule-form .form-row {
    margin-bottom: 14px;
}

.rule-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 12px;
    color: #3c434a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rule-form input[type="text"],
.rule-form input[type="number"],
.rule-form select {
    width: 100%;
    max-width: 420px;
    border-radius: 5px;
    border-color: #c3c4c7;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.rule-form input[type="text"]:focus,
.rule-form input[type="number"]:focus,
.rule-form select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
    outline: none;
}

.rule-form .description {
    display: block;
    margin-top: 4px;
    color: #8c8f94;
    font-size: 11px;
    font-style: italic;
}

/* Exclusion specific badges */
.badge-exclusion-product {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-exclusion-category {
    background: #fdf2f8;
    color: #9d174d;
    border: 1px solid #fbcfe8;
}

.badge-exclusion-tag {
    background: #faf5ff;
    color: #7c3aed;
    border: 1px solid #e9d5ff;
}

.badge-exclusion-user_role {
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

.badge-exclusion-user {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.rule-reason {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-left: 10px;
}

/* Exclusion selectors */
.exclusion-selector {
    display: none;
}

.exclusion-target-row .exclusion-selector {
    width: 100%;
}

/* Footer info */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-info {
    flex: 1;
}

.info-text {
    color: #a7aaad;
    font-size: 11px;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 5px;
}

.info-text::before {
    content: "✓";
    display: inline-block;
    background: #00a32a;
    color: #fff;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    font-size: 9px;
    line-height: 14px;
    text-align: center;
    flex-shrink: 0;
}

.modal-footer .button-secondary {
    border-radius: 5px;
    font-weight: 500;
}

/* Loading states */
.loading-spinner {
    text-align: center;
    padding: 20px;
}

.loading-spinner .spinner {
    float: none;
    margin: 0 auto 10px;
    display: block;
}

/* No items message */
.no-items {
    text-align: center;
    padding: 28px 20px;
    color: #a7aaad;
    font-style: italic;
    font-size: 13px;
}

/* Notice styles in modal */
.modal-body .notice {
    margin: 10px 0;
}

/* Rules Management Table Styling */
.rules-management-wrapper {
    margin-top: 20px;
}

.rules-management-wrapper .wp-list-table {
    border: 1px solid #c3c4c7;
}

.rules-management-wrapper .column-addon {
    width: 25%;
}

.rules-management-wrapper .column-assignments,
.rules-management-wrapper .column-exclusions {
    width: 25%;
}

.rules-management-wrapper .column-priority {
    width: 10%;
    text-align: center;
}

.rules-management-wrapper .column-actions {
    width: 15%;
    text-align: center;
}

.rules-management-wrapper .addon-type {
    margin-top: 5px;
}

.rules-management-wrapper .badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 3px;
    background: #f0f0f0;
    color: #666;
}

.rules-management-wrapper .badge-global_addon {
    background: #e3f2fd;
    color: #1565c0;
}

.rules-management-wrapper .assignment-summary,
.rules-management-wrapper .exclusion-summary {
    font-size: 13px;
    color: #555;
}

.rules-management-wrapper .priority-value {
    font-weight: 600;
    font-size: 14px;
}

.rules-info {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.rules-info h3 {
    margin-top: 0;
    color: #23282d;
}

.rules-info ul li {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #23282d !important;
}

.rules-info ul li strong {
    color: #23282d !important;
    font-weight: 600;
}

/* Row Actions - Ensure visibility */
.smart-addons-list-table .row-actions {
    visibility: visible !important;
    position: static !important;
}

.smart-addons-list-table tr:hover .row-actions {
    visibility: visible !important;
}

.column-name .row-actions {
    color: #646970;
    font-size: 13px;
    padding: 2px 0 0;
}

.column-name .row-actions .submitdelete {
    color: #b32d2e;
}

.column-name .row-actions .submitdelete:hover {
    color: #a00;
}

.column-name .row-actions .manage-addon-rules {
    font-weight: 500;
}

.column-name .row-actions .manage-addon-rules .dashicons {
    width: auto;
    height: auto;
    margin-right: 2px;
}

.column-name .row-actions a {
    color: #2271b1;
    text-decoration: none;
}

.column-name .row-actions a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 782px) {
    .global-addon-modal .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .global-addon-modal .modal-header,
    .global-addon-modal .modal-body,
    .global-addon-modal .modal-footer {
        padding: 15px;
    }

    .priority-input {
        width: 50px;
    }

    .smart-addons-section .form-table th {
        width: auto;
        display: block;
        padding-bottom: 5px;
    }

    .smart-addons-section .form-table td {
        display: block;
        padding-top: 5px;
    }

    .select2-container {
        min-width: 100%;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .global-addon-modal,
    .page-title-action,
    .nav-tab-wrapper,
    .tablenav,
    .row-actions {
        display: none !important;
    }

    .smart-addons-content {
        box-shadow: none;
        border: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .addon-status,
    .addon-type,
    .display-style {
        border: 1px solid;
    }

    .status-active {
        border-color: #155724;
    }

    .status-inactive {
        border-color: #721c24;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .loading::after {
        animation: none;
    }
}

/* Assignment Modal Specific Styles */
#assignment-modal .modal-content {
    max-width: 900px;
}

#assignment-modal .modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.assignments-section,
.add-assignment-section {
    margin-bottom: 30px;
}

.assignments-section h3,
.add-assignment-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.assignments-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background: #f9f9f9;
}

.assignment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.assignment-item:last-child {
    margin-bottom: 0;
}

.assignment-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.assignment-type-badge {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-global {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.badge-product {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-category {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.badge-tag {
    background: #faf5ff;
    color: #7c3aed;
    border: 1px solid #e9d5ff;
}

.badge-guest,
.badge-exclusion-guest {
    background: #fdf2f8;
    color: #9d174d;
    border: 1px solid #fbcfe8;
}

.badge-user_role,
.badge-exclusion-user_role {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.badge-user,
.badge-exclusion-user {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.assignment-target {
    color: #555;
    font-weight: 500;
}

.assignment-priority {
    color: #666;
    font-size: 12px;
}

.assignment-status {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.assignment-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

/* Assignment Toggle Switch */
.assignment-toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    margin-left: 8px;
}

.assignment-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.assignment-toggle-switch .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 20px;
}

.assignment-toggle-switch .toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.assignment-toggle-switch input:checked + .toggle-slider {
    background-color: #2271b1;
}

.assignment-toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 1px #2271b1;
}

.assignment-toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.assignment-toggle-switch input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.assignment-form {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.assignment-form .form-row {
    margin-bottom: 14px;
}

.assignment-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 12px;
    color: #3c434a;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.assignment-form input[type="text"],
.assignment-form input[type="number"],
.assignment-form select {
    width: 100%;
    max-width: 400px;
    border-radius: 5px;
    border-color: #c3c4c7;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.assignment-form input[type="text"]:focus,
.assignment-form input[type="number"]:focus,
.assignment-form select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
    outline: none;
}

.assignment-form input[type="checkbox"] {
    margin-right: 5px;
}

.assignment-form .description {
    display: block;
    margin-top: 4px;
    color: #8c8f94;
    font-size: 11px;
    font-style: italic;
}

.assignment-target-row {
    margin-top: 15px;
}

.target-selector {
    margin-top: 10px;
}

.form-actions {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e8eaed;
    display: flex;
    gap: 8px;
}

.form-actions .button-primary {
    background: linear-gradient(135deg, #2271b1 0%, #1a5a8f 100%);
    border-color: #1a5a8f;
    box-shadow: 0 1px 3px rgba(34, 113, 177, 0.3);
    transition: all 0.15s;
}

.form-actions .button-primary:hover {
    background: linear-gradient(135deg, #1a5a8f 0%, #135079 100%);
    box-shadow: 0 2px 6px rgba(34, 113, 177, 0.4);
    transform: translateY(-1px);
}

.no-assignments {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

.loading-spinner {
    text-align: center;
    padding: 30px;
}

.loading-spinner .spinner {
    float: none;
    margin: 0 10px 0 0;
}

/* Addon Status Toggle Switch */
.addon-status-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 8px;
}

.addon-status-toggle input[type="checkbox"] {
    display: none;
}

.addon-status-toggle .toggle-slider {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 20px;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.addon-status-toggle .toggle-slider:before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.addon-status-toggle input:checked + .toggle-slider {
    background-color: #2271b1;
}

.addon-status-toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.addon-status-toggle .toggle-label {
    font-size: 12px;
    color: #555;
    min-width: 50px;
}

.addon-status-toggle input:checked ~ .toggle-label {
    color: #2271b1;
    font-weight: 500;
}

.addon-status-toggle:hover .toggle-slider {
    background-color: #999;
}

.addon-status-toggle input:checked:hover + .toggle-slider {
    background-color: #135e96;
}

.addon-status-toggle.loading {
    pointer-events: none;
}

.addon-status-toggle.loading .toggle-slider {
    opacity: 0.5;
}

.addon-status-toggle input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   Pro Upsell Design System — unified notices for Pro-gated features
   --------------------------------------------------------------------------
   Three coordinated variants, all sharing the purple brand (#667eea → #764ba2):
     .wgp-pro-badge  — small inline pill next to feature labels
     .wgp-pro-note   — one-line subtle note under a form field / button
     .wgp-pro-card   — section-level promotional card (tinted bg, left border)
   Every variant is promotional in tone — no error/warning visuals.
   ========================================================================== */

/* Pro Badge — small inline pill */
.wgp-pro-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    cursor: help;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.wgp-pro-badge:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a1 100%);
}

/* Pro Note — inline one-liner under a field or button */
.wgp-pro-note {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0 0;
    padding: 0;
    color: #5a4fcf;
    font-size: 12px;
    font-style: normal;
    line-height: 1.5;
}

.wgp-pro-note .wgp-pro-badge {
    margin-left: 0;
}

.wgp-pro-note__cta {
    color: #5a4fcf;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(90, 79, 207, 0.4);
    padding-bottom: 1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.wgp-pro-note__cta:hover,
.wgp-pro-note__cta:focus {
    color: #764ba2;
    border-bottom-color: #764ba2;
}

/* Pro Card — section-level promotional banner */
.wgp-pro-card {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 15px 0;
    padding: 12px 16px;
    background: linear-gradient(90deg, #f5f3ff 0%, #faf7ff 100%);
    border-left: 3px solid #667eea;
    border-radius: 4px;
    color: #3d3565;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.08);
}

.wgp-pro-card .wgp-pro-badge {
    margin-left: 0;
    flex-shrink: 0;
}

.wgp-pro-card__message {
    flex: 1;
    min-width: 200px;
    color: #3d3565;
}

.wgp-pro-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.2);
}

.wgp-pro-card__cta:hover,
.wgp-pro-card__cta:focus {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46a1 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.wgp-pro-card__cta::after {
    content: '→';
    font-size: 14px;
    line-height: 1;
}

/* Dismiss button on persistent Pro cards (JS notices) */
.wgp-pro-card .notice-dismiss {
    position: absolute;
    top: 4px;
    right: 4px;
    border: none;
    background: transparent;
    color: #8a7fc4;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 16px;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.15s ease, background 0.15s ease;
}

.wgp-pro-card .notice-dismiss:hover,
.wgp-pro-card .notice-dismiss:focus {
    color: #5a4fcf;
    background: rgba(102, 126, 234, 0.1);
}

.wgp-pro-card .notice-dismiss::before {
    content: '\00d7';
    font-weight: 400;
}

/* Backward-compatible alias: existing .wgp-upgrade-notice markup
   gets the new .wgp-pro-card look automatically. */
.wgp-upgrade-notice {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 15px 0;
    padding: 12px 16px;
    background: linear-gradient(90deg, #f5f3ff 0%, #faf7ff 100%);
    border-left: 3px solid #667eea;
    border-radius: 4px;
    color: #3d3565;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.08);
}

.wgp-upgrade-notice a {
    color: #5a4fcf;
    text-decoration: underline;
}

.wgp-upgrade-notice a:hover {
    color: #764ba2;
}

/* Disabled state for premium-only features */
.wgp-pro-disabled {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.wgp-pro-disabled::after {
    content: '';
    position: absolute;
    inset: 0;
    cursor: not-allowed;
}

/* Pro badge in select options */
select option[disabled] {
    color: #999;
    font-style: italic;
}

/* Pro template card styling */
.global-addon-template-option.wgp-pro-template {
    opacity: 0.7;
    position: relative;
}

.global-addon-template-option.wgp-pro-template::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.5);
    z-index: 1;
    border-radius: 6px;
}

.global-addon-template-option.wgp-pro-template .wgp-pro-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
}

.global-addon-template-option.wgp-pro-template:hover {
    cursor: not-allowed;
}

/* Pro feature in form fields */
.wgp-pro-field {
    position: relative;
}

.wgp-pro-field input:disabled,
.wgp-pro-field textarea:disabled,
.wgp-pro-field select:disabled {
    background-color: #f7f7f7;
    cursor: not-allowed;
}

/* Settings Accordion */
.settings-accordion {
    max-width: 900px;
}

.settings-section {
    border: 1px solid #dcdcde;
    border-radius: 4px;
    margin-bottom: 12px;
    background: #fff;
    overflow: hidden;
}

.settings-section-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    margin: 0;
    background: #f6f7f7;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    transition: background-color 0.15s ease;
}

.settings-section-header:hover {
    background: #f0f0f1;
}

.settings-section.is-open .settings-section-header {
    border-bottom-color: #dcdcde;
    background: #fff;
}

.settings-section-header .dashicons {
    margin-right: 10px;
    color: #787c82;
}

.settings-section-header .toggle-indicator {
    margin-left: auto;
    width: 20px;
    height: 20px;
    position: relative;
}

.settings-section-header .toggle-indicator::before {
    content: '\f140';
    font-family: dashicons;
    font-size: 20px;
    line-height: 1;
    color: #787c82;
    transition: transform 0.2s ease;
    display: block;
}

.settings-section.is-open .settings-section-header .toggle-indicator::before {
    transform: rotate(180deg);
}

.settings-section-content {
    display: none;
    padding: 0 16px 16px;
}

.settings-section.is-open .settings-section-content {
    display: block;
}

.settings-section .form-table {
    margin-top: 0;
}

.settings-section .form-table th {
    padding-top: 16px;
    padding-bottom: 16px;
}

.settings-section .form-table td {
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Empty State Onboarding */
.wgpa-empty-state {
    text-align: center;
    padding: 60px 40px;
    max-width: 700px;
    margin: 0 auto;
}

.wgpa-empty-state .empty-state-icon {
    margin-bottom: 24px;
}

.wgpa-empty-state .empty-state-icon .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: #2271b1;
    opacity: 0.7;
}

.wgpa-empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1d2327;
    margin: 0 0 12px;
}

.wgpa-empty-state .empty-state-description {
    font-size: 15px;
    color: #646970;
    line-height: 1.6;
    margin-bottom: 40px;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.wgpa-empty-state .empty-state-steps {
    display: flex;
    gap: 24px;
    margin-bottom: 40px;
    text-align: left;
}

.wgpa-empty-state .step {
    flex: 1;
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #f6f7f7;
    border-radius: 8px;
}

.wgpa-empty-state .step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #2271b1;
    color: #fff;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.wgpa-empty-state .step-content strong {
    display: block;
    color: #1d2327;
    margin-bottom: 4px;
    font-size: 13px;
}

.wgpa-empty-state .step-content p {
    margin: 0;
    color: #646970;
    font-size: 12px;
    line-height: 1.5;
}

.wgpa-empty-state .empty-state-cta .button-hero {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    height: auto;
}

.wgpa-empty-state .empty-state-cta .button-hero .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

@media screen and (max-width: 782px) {
    .wgpa-empty-state .empty-state-steps {
        flex-direction: column;
    }

    .wgpa-empty-state {
        padding: 40px 20px;
    }
}

/* ============================================================
   Rule Groups — group cards, OR separator, add-group button
   ============================================================ */

.wgpao-rule-groups {
    max-height: none;
    overflow-y: visible;
    padding: 0;
    background: transparent;
    border: none;
}

.wgpao-rule-group {
    border: 1px solid #c3c4c7;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 0;
    overflow: hidden;
}

.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #f0f6ff;
    border-bottom: 1px solid #c3c4c7;
    font-size: 12px;
    font-weight: 600;
    color: #2271b1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.group-header .remove-group {
    color: #d63638;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 11px;
    text-decoration: underline;
    padding: 0;
    box-shadow: none;
    height: auto;
    line-height: 1;
}

.group-rules {
    padding: 8px;
}

.group-rules .rule-item:last-child {
    margin-bottom: 0;
}

.no-rules-in-group {
    text-align: center;
    color: #888;
    font-size: 12px;
    padding: 10px;
    margin: 0;
}

/* OR separator between groups */
.wgpao-group-or-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 8px 0;
    color: #888;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wgpao-group-or-separator::before,
.wgpao-group-or-separator::after {
    content: '';
    flex: 1;
    border-top: 1px dashed #c3c4c7;
    margin: 0 8px;
}

/* Add-group button row */
.wgpao-add-group-row {
    margin-top: 10px;
    text-align: left;
}

.wgpao-add-group-row .button {
    font-size: 12px;
    padding: 4px 12px;
    height: auto;
    line-height: 1.8;
    color: #2271b1;
    border-color: #2271b1;
}

/* Addon Type segmented pill toggle (Single / Multi-option) */
.form-field._wgpao_is_single_field .wgpao-segmented-toggle {
    display: inline-flex;
    background: #f0f0f1;
    border: 1px solid #dcdcde;
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    vertical-align: middle;
}
.form-field._wgpao_is_single_field .wgpao-segmented-toggle input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
    margin: 0;
}
.form-field._wgpao_is_single_field .wgpao-segment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 18px;
    min-width: 110px;
    margin: 0;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: #50575e;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}
.form-field._wgpao_is_single_field .wgpao-segment:hover {
    color: #1d2327;
}
.form-field._wgpao_is_single_field input[type="radio"]:checked + .wgpao-segment {
    background: #fff;
    color: #2271b1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.form-field._wgpao_is_single_field input[type="radio"]:focus-visible + .wgpao-segment {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}
.form-field._wgpao_is_single_field .wgpao-segmented-hint {
    display: block;
    margin-top: 6px;
    color: #646970;
    font-style: italic;
}

/* Addon type badge — matches the neutral style of .display-style badges */
.wgpao-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
    background: #f1f1f1;
    color: #555;
}
.wgpao-type-badge::before {
    font-family: dashicons;
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1;
}
.wgpao-type-multi::before {
    content: "\f338"; /* dashicons-screenoptions */
}
.wgpao-type-single::before {
    content: "\f147"; /* dashicons-yes (single tick) */
}
