/**
 * IAB TCF Vendors Management Styles
 */

.wpconsent-iab-tcf-vendors {
    max-width: 100%;
    margin: 20px 0;
}

/* Vendor Controls */
.wpconsent-vendor-controls {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.wpconsent-vendor-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 15px;
}

.wpconsent-vendor-search {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
    min-width: 300px;
}

.wpconsent-vendor-search input[type="text"] {
    flex: 1;
    min-width: 250px;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
}

.wpconsent-vendor-search input[type="text"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.wpconsent-vendor-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wpconsent-vendor-filters select {
    padding: 6px 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    min-width: 120px;
}

.wpconsent-vendor-results-info {
    color: #646970;
    font-size: 14px;
    font-style: italic;
}

.wpconsent-vendor-save-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f1;
    text-align: right;
}

.wpconsent-vendor-save-section .wpconsent-button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
}

/* Vendor List */
.wpconsent-vendor-list {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.wpconsent-no-vendors {
    padding: 40px 20px;
    text-align: center;
    color: #646970;
    font-size: 16px;
}

/* Vendor Item */
.wpconsent-vendor-item {
    border-bottom: 1px solid #f0f0f1;
    transition: background-color 0.2s ease;
}

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

.wpconsent-vendor-item:hover {
    background-color: #f6f7f7;
}

.wpconsent-vendor-item.selected {
    background-color: #e7f3ff;
    border-left: 4px solid #2271b1;
}

.wpconsent-vendor-item.selected:hover {
    background-color: #d0e7ff;
}

/* Vendor Header */
.wpconsent-vendor-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    gap: 15px;
}

.wpconsent-vendor-selection {
    flex-shrink: 0;
}

.wpconsent-vendor-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.wpconsent-vendor-info {
    flex: 1;
    min-width: 0;
}

.wpconsent-vendor-name {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.3;
}

.wpconsent-vendor-name label {
    cursor: pointer;
    display: block;
}

.wpconsent-vendor-id {
    font-weight: 400;
    color: #646970;
    font-size: 14px;
}

.wpconsent-vendor-policy {
    margin-top: 5px;
}

.wpconsent-vendor-policy a {
    color: #2271b1;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wpconsent-vendor-policy a:hover {
    color: #135e96;
    text-decoration: underline;
}

.wpconsent-vendor-policy .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.wpconsent-vendor-toggle {
    flex-shrink: 0;
}

.wpconsent-vendor-details-toggle {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    color: #646970;
    transition: all 0.2s ease;
}

.wpconsent-vendor-details-toggle:hover {
    background-color: #f0f0f1;
    color: #2271b1;
}

.wpconsent-vendor-details-toggle .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

/* Vendor Details */
.wpconsent-vendor-details {
    padding: 0 20px 20px 53px;
    border-top: 1px solid #f0f0f1;
    background-color: #fafafa;
}

.wpconsent-vendor-purposes,
.wpconsent-vendor-special-purposes {
    margin-bottom: 20px;
}

.wpconsent-vendor-purposes:last-child,
.wpconsent-vendor-special-purposes:last-child {
    margin-bottom: 0;
}

.wpconsent-vendor-purposes h4,
.wpconsent-vendor-special-purposes h4 {
    margin: 0 0 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: #1d2327;
}

.wpconsent-purposes-section {
    margin-bottom: 15px;
}

.wpconsent-purposes-section:last-child {
    margin-bottom: 0;
}

.wpconsent-purposes-section h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #2271b1;
}

.wpconsent-purposes-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.wpconsent-purposes-list li {
    padding: 6px 0;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
    line-height: 1.4;
}

.wpconsent-purposes-list li:last-child {
    border-bottom: none;
}

.wpconsent-purposes-list li strong {
    color: #1d2327;
    font-weight: 600;
}

/* Vendor Pagination */
.wpconsent-vendor-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.wpconsent-pagination-info {
    color: #646970;
    font-size: 14px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 782px) {
    .wpconsent-vendor-controls-row {
        flex-direction: column;
        gap: 15px;
    }

    .wpconsent-vendor-search {
        min-width: auto;
        width: 100%;
    }

    .wpconsent-vendor-search input[type="text"] {
        min-width: auto;
    }

    .wpconsent-vendor-filters {
        width: 100%;
        justify-content: space-between;
    }

    .wpconsent-vendor-filters select {
        flex: 1;
        min-width: auto;
    }

    .wpconsent-vendor-header {
        padding: 12px 15px;
        gap: 12px;
    }

    .wpconsent-vendor-details {
        padding: 0 15px 15px 42px;
    }

    .wpconsent-vendor-pagination {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 600px) {
    .wpconsent-vendor-search {
        flex-direction: column;
        align-items: stretch;
    }

    .wpconsent-vendor-search input[type="text"] {
        margin-bottom: 10px;
    }

    .wpconsent-vendor-filters {
        flex-direction: column;
        gap: 10px;
    }

    .wpconsent-vendor-name {
        font-size: 15px;
    }

    .wpconsent-vendor-id {
        font-size: 13px;
    }
}

/* Loading and Error States */
.wpconsent-vendor-loading {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
}

.wpconsent-vendor-error {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-left: 4px solid #dc3232;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.wpconsent-vendor-error p {
    margin: 0 0 15px 0;
    color: #1d2327;
}

.wpconsent-vendor-error p:last-child {
    margin-bottom: 0;
}

/* Notification Styles */
.wpconsent-vendor-save-notification {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Button Overrides for Consistency */
.wpconsent-vendor-controls .wpconsent-button {
    height: auto;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.4;
}

.wpconsent-vendor-pagination .wpconsent-button {
    padding: 8px 16px;
    font-size: 14px;
}

/* Focus States for Accessibility */
.wpconsent-vendor-checkbox:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.wpconsent-vendor-details-toggle:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.wpconsent-vendor-header:focus-within {
    background-color: #f6f7f7;
}

/* Additional Accessibility Styles */
.wpconsent-vendor-item:focus-within {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}

/* Publisher Restrictions Styles */

/* Checkbox group styling for purpose selection */
.wpconsent-checkbox-group {
    display: block;
    margin: 0;
    padding: 0;
}

.wpconsent-checkbox-label {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3338;
    line-height: 1.5;
}

.wpconsent-checkbox-label:last-child {
    margin-bottom: 0;
}

.wpconsent-checkbox-label input[type="checkbox"] {
    margin: 2px 8px 0 0;
    cursor: pointer;
    flex-shrink: 0;
}

.wpconsent-checkbox-label span {
    user-select: none;
    flex: 1;
}

/* Per-Vendor Restrictions */
.wpconsent-vendor-restrictions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dcdcde;
}

.wpconsent-vendor-restrictions h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.wpconsent-restrictions-description {
    font-size: 13px;
    color: #646970;
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.wpconsent-restrictions-section {
    margin-bottom: 20px;
}

.wpconsent-restrictions-section:last-child {
    margin-bottom: 0;
}

.wpconsent-restrictions-section h5 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #2c3338;
}

.wpconsent-restrictions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wpconsent-restriction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #f6f7f7;
    border-radius: 4px;
    gap: 15px;
}

.wpconsent-restriction-label {
    flex: 1;
    font-size: 13px;
    color: #2c3338;
    margin: 0;
}

.wpconsent-restriction-label strong {
    font-weight: 600;
    margin-right: 5px;
}

.wpconsent-restriction-control {
    flex-shrink: 0;
}

.wpconsent-select-small {
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    background: #fff;
    min-width: 150px;
}

.wpconsent-select-small:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Responsive adjustments for restrictions */
@media screen and (max-width: 782px) {
    .wpconsent-restriction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .wpconsent-restriction-control {
        width: 100%;
    }

    .wpconsent-select-small {
        width: 100%;
    }
}

@media screen and (max-width: 600px) {
    .wpconsent-vendor-restrictions {
        padding-top: 15px;
        margin-top: 15px;
    }

    .wpconsent-restrictions-section {
        margin-bottom: 15px;
    }
}

/* Publisher Declarations Collapsible Sections */
.wpconsent-publisher-declarations-section {
    border: 1px solid #dcdcde;
    border-radius: 4px;
    margin-bottom: 15px;
    background: #fff;
}

.wpconsent-section-header {
    border-bottom: 1px solid #dcdcde;
}

.wpconsent-section-toggle {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    text-align: left;
    transition: background-color 0.2s ease;
}

.wpconsent-section-toggle:hover {
    background-color: #f6f7f7;
}

.wpconsent-section-toggle:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}

.wpconsent-section-toggle .dashicons {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: #646970;
    transition: transform 0.2s ease;
}

.wpconsent-section-toggle[aria-expanded="true"] .dashicons {
    transform: rotate(90deg);
}

.wpconsent-section-toggle strong {
    flex: 1;
    color: #1d2327;
}

.wpconsent-section-count {
    color: #646970;
    font-size: 13px;
    font-weight: 400;
}

.wpconsent-section-content {
    padding: 16px;
    border-top: 1px solid #f0f0f1;
}

.wpconsent-section-content .wpconsent-field-description {
    margin-top: 0;
    margin-bottom: 12px;
}

.wpconsent-section-content .wpconsent-checkbox-group {
    margin-top: 0;
}

/* Responsive adjustments for collapsible sections */
@media screen and (max-width: 782px) {
    .wpconsent-section-toggle {
        padding: 10px 12px;
        font-size: 13px;
    }

    .wpconsent-section-content {
        padding: 12px;
    }
}

@media screen and (max-width: 600px) {
    .wpconsent-publisher-declarations-section {
        margin-bottom: 12px;
    }

    .wpconsent-section-toggle {
        flex-wrap: wrap;
        gap: 8px;
    }

    .wpconsent-section-count {
        flex-basis: 100%;
        padding-left: 30px;
    }
}