.affiliation-settings-wrap {
    max-width: 1200px;
    margin: 20px 0;
}

.affiliation-header {
    position: relative;
    background: white;
    color: #333;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
    overflow: hidden;
}

/* Linea animata gradiente */
.affiliation-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(202, 38, 34, 0.8) 50%, 
        transparent 100%
    );
    animation: slideGradient 3s ease-in-out infinite;
}

/* Animazione della linea */
@keyframes slideGradient {
    0% {
        left: -100%;
        opacity: 0;
    }
    
    50% {
        opacity: 1;
    }
    
    100% {
        left: 100%;
        opacity: 0;
    }
}

.affiliation-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.affiliation-header h1 .dashicons {
    font-size: 28px;
    line-height: 1;
    vertical-align: middle;
}

.affiliation-header .description {
    margin: 0;
    color: #666;
    font-size: 16px;
}

/* Variante alternativa con linea pulsante */
.affiliation-header.pulse::before {
    left: 0;
    width: 100%;
    animation: pulseGradient 2s ease-in-out infinite;
}

@keyframes pulseGradient {
    0%, 100% {
        opacity: 0.3;
        transform: scaleX(0.8);
    }
    
    50% {
        opacity: 1;
        transform: scaleX(1);
    }
}

/* Variante con linea che si espande dal centro */
.affiliation-header.expand::before {
    left: 50%;
    width: 0;
    transform: translateX(-50%);
    animation: expandGradient 2.5s ease-in-out infinite;
}

@keyframes expandGradient {
    0%, 100% {
        width: 0;
        opacity: 0;
    }
    
    50% {
        width: 100%;
        opacity: 1;
    }
}

.affiliation-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

/* Form Styling */
.settings-form-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.affiliation-form {
    padding: 30px;
}

.settings-section-description {
    color: #666;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-left: 4px solid #ca2622;
    border-radius: 4px;
}

.field-container {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.field-container:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.field-input,
.field-textarea,
.field-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.field-input:focus,
.field-textarea:focus,
.field-select:focus {
    border-color: #ca2622;
    box-shadow: 0 0 0 3px rgba(202, 38, 34, 0.1);
    outline: none;
}

.field-description {
    margin: 8px 0 0 0;
    color: #666;
    font-size: 13px;
    font-style: italic;
}

.submit-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f1;
    text-align: center;
}

/* Submit Button Hero - sostituito viola con rosso */
.affiliation-form .button-primary,
.button-hero {
    padding: 15px 30px !important;
    font-size: 16px !important;
    border-radius: 6px !important;
    background: linear-gradient(135deg, #ca2622 0%, #8b1b1b 100%) !important;
    border: none !important;
    color: #fff !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    transition: background 0.2s ease, box-shadow 0.2s ease !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.affiliation-form .button-primary .dashicons,
.button-hero .dashicons {
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

.affiliation-form .button-primary:hover,
.button-hero:hover {
    background: linear-gradient(135deg, #d22b27 0%, #971f1f 100%) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

/* Shine effect */
/* Rimuove shine effect per un hover più semplice ed elegante */
.affiliation-form .button-primary::after,
.button-hero::after { display: none; }

.affiliation-form .button-primary:active,
.button-hero:active {
    background: linear-gradient(135deg, #b8221f 0%, #7a1717 100%) !important;
}

.affiliation-form .button-primary:focus-visible,
.button-hero:focus-visible {
    box-shadow: 0 0 0 3px rgba(202, 38, 34, 0.3), 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    outline: none;
}

.affiliation-form .button-primary[disabled],
.affiliation-form .button-primary:disabled,
.button-hero[disabled],
.button-hero:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Actions Container */
.actions-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.actions-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 25px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

/* Centered custom lock control */
.lock-control {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.lock-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.lock-btn:hover {
    background: rgba(202, 38, 34, 0.08);
}

.lock-btn:active {
    transform: scale(0.98);
}

.lock-form {
    display: none;
    gap: 8px;
    align-items: center;
}

.lock-form.visible { display: inline-flex; }

.lock-input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 200px;
}

.lock-submit {
    border: none;
    background: #ca2622;
    color: white;
    border-radius: 4px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.lock-submit:hover {
    background: #b8221f;
}

.lock-submit.lock-on {
    background: #666;
}

.actions-card h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.actions-card h3 .dashicons {
    font-size: 18px;
    line-height: 1;
    vertical-align: middle;
}

.card-description {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.action-buttons-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.action-card {
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    padding: 20px;
    transition: border-color 0.3s ease;
}

.action-card:hover {
    border-color: #ca2622;
}

.action-card.danger {
    border-color: #dc3545;
}

.action-card.danger:hover {
    border-color: #c82333;
}

.action-header h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-header h4 .dashicons {
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

.action-header p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 13px;
}

.action-form {
    margin: 0;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.form-control {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.action-button {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px !important;
    border-radius: 4px !important;
    line-height: 1.4;
}

.action-button .dashicons {
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

.action-button.danger {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
}

.action-button.danger:hover {
    background: #c82333 !important;
    border-color: #bd2130 !important;
}

/* Toggle Switch Styling - Versione corretta */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

/* Fix per nascondere completamente la checkbox */
.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    visibility: hidden;
    pointer-events: none;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
    background-color: #ccc;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    user-select: none;
    overflow: hidden;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.toggle-input:checked + .toggle-label {
    background-color: #ca2622;
}

.toggle-input:checked + .toggle-label .toggle-slider {
    transform: translateX(30px);
}

/* Testo ON/OFF con posizionamento corretto */
.toggle-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.toggle-on,
.toggle-off {
    transition: opacity 0.3s ease;
    line-height: 1;
    letter-spacing: 0.5px;
}

.toggle-on {
    opacity: 0;
    margin-left: 2px; /* Ridotto margin per ON */
}

.toggle-off {
    opacity: 1;
    margin-right: 0; /* Rimosso margin per OFF */
}

.toggle-input:checked + .toggle-label .toggle-on {
    opacity: 1;
}

.toggle-input:checked + .toggle-label .toggle-off {
    opacity: 0;
}

/* Aggiustamenti per la versione moderna */
.toggle-switch.modern .toggle-text {
    padding: 0 6px 0 10px; /* Aggiustato padding per versione moderna */
    font-size: 8px;
}

.toggle-switch.modern .toggle-on {
    margin-left: 1px;
}

.toggle-switch.modern .toggle-off {
    margin-right: 0;
}

/* Hover effects */
.toggle-label:hover {
    box-shadow: 0 0 0 3px rgba(202, 38, 34, 0.2);
}

.toggle-input:focus + .toggle-label {
    box-shadow: 0 0 0 3px rgba(202, 38, 34, 0.3);
}

/* Disabled state */
.toggle-input:disabled + .toggle-label {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Alternative modern style */
.toggle-switch.modern .toggle-label {
    width: 50px;
    height: 24px;
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
    border: 1px solid #ddd;
}

.toggle-switch.modern .toggle-slider {
    width: 18px;
    height: 18px;
    top: 2px;
    left: 2px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border: 1px solid #ddd;
}

.toggle-switch.modern .toggle-input:checked + .toggle-label {
    background: linear-gradient(145deg, #ca2622, #8b1b1b);
    border-color: #ca2622;
}

.toggle-switch.modern .toggle-input:checked + .toggle-label .toggle-slider {
    transform: translateX(26px);
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-color: #fff;
}

.toggle-switch.modern .toggle-text {
    padding: 0 4px 0 8px; /* Padding asimmetrico anche per la versione moderna */
    font-size: 8px;
}

/* Environment Select Styling */
.environment-select-container {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.environment-header h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.environment-header h4 .dashicons {
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

.environment-header p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 13px;
}

.environment-form {
    margin: 0;
}

.environment-select-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.current-environment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
}

.current-environment .dashicons {
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

.env-label {
    color: #333;
}

.environment-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="5" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.environment-select:focus {
    border-color: #ca2622;
    box-shadow: 0 0 0 3px rgba(202, 38, 34, 0.1);
    outline: none;
}

.environment-select:hover {
    border-color: #ca2622;
}

/* Environment Select Options Styling (limitato supporto browser) */
.environment-select option {
    padding: 10px;
    font-size: 14px;
}

.environment-select option[value="staging"] {
    background-color: rgba(255, 152, 0, 0.1);
}

.environment-select option[value="prod"] {
    background-color: rgba(76, 175, 80, 0.1);
}

.environment-select option[value="local"] {
    background-color: rgba(33, 150, 243, 0.1);
}

/* Visual improvements for environment indicators */
.current-environment.staging {
    border-left-color: #ff9800;
    background: linear-gradient(90deg, rgba(255, 152, 0, 0.05) 0%, white 20%);
}

.current-environment.prod {
    border-left-color: #4caf50;
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.05) 0%, white 20%);
}

.current-environment.local {
    border-left-color: #2196f3;
    background: linear-gradient(90deg, rgba(33, 150, 243, 0.05) 0%, white 20%);
}

/* Cache Toggle in Sidebar - aggiornato per separazione */
.cache-toggle-container {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.cache-toggle-header h4 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cache-toggle-header h4 .dashicons {
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
}

.cache-toggle-header p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 13px;
}

.cache-toggle-form {
    margin: 0;
}

.cache-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cache-status {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Multiselect Styling */
.multiselect-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selected-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 8px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    background: #f9f9f9;
    align-items: flex-start;
    align-content: flex-start;
}

.selected-badges:empty::before {
    content: "Nessun post type selezionato";
    color: #999;
    font-style: italic;
    font-size: 14px;
    display: flex;
    align-items: center;
    height: 24px;
}

.post-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #ca2622 0%, #8b1b1b 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

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

.remove-badge {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    transition: background-color 0.2s ease;
}

.remove-badge:hover {
    background: rgba(255, 255, 255, 0.5);
}

.multiselect-dropdown {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.multiselect-dropdown:focus {
    border-color: #ca2622;
    box-shadow: 0 0 0 3px rgba(202, 38, 34, 0.1);
    outline: none;
}

.multiselect-dropdown:hover {
    border-color: #ca2622;
}

.multiselect-dropdown option {
    padding: 8px;
    font-size: 14px;
}

/* Varianti di colore per i badge */
.post-type-badge[data-value="post"] {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

.post-type-badge[data-value="page"] {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.post-type-badge[data-value="product"] {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.post-type-badge[data-value="attachment"] {
    background: linear-gradient(135deg, #ca2622 0%, #8b1b1b 100%);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .affiliation-content {
        grid-template-columns: 1fr;
    }
    
    .action-buttons-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .affiliation-header {
        padding: 20px;
    }
    
    .affiliation-header h1 {
        font-size: 24px;
        gap: 6px;
    }
    
    .affiliation-header h1 .dashicons {
        font-size: 24px;
    }
    
    .actions-card h3 {
        font-size: 16px;
        gap: 6px;
    }
    
    .actions-card h3 .dashicons {
        font-size: 16px;
    }
    
    .action-button {
        gap: 4px;
        padding: 6px 12px !important;
    }
    
    .action-button .dashicons {
        font-size: 14px;
    }
    
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toggle-switch {
        justify-content: flex-start;
    }
    
    .toggle-label {
        width: 50px;
        height: 26px;
    }
    
    .toggle-slider {
        width: 20px;
        height: 20px;
        top: 2px;
        left: 2px;
    }
    
    .toggle-input:checked + .toggle-label .toggle-slider {
        transform: translateX(24px);
    }
    
    .toggle-text {
        padding: 0 6px 0 10px; /* Aggiustato padding per mobile */
        font-size: 8px;
    }
    
    .cache-toggle-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .environment-select-wrapper {
        gap: 8px;
    }
    
    .current-environment {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .environment-select {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Animazioni */
@keyframes badgeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.post-type-badge {
    animation: badgeIn 0.2s ease-out;
}
