/*
 * Silktide Cookie Banner Manager Styles
 * A lightweight, customizable cookie consent banner for websites
 * https://github.com/silktide/consent-manager
 */

:root {
    --silktide-consent-manager-primary-color: #007cba;
    --silktide-consent-manager-secondary-color: #6c757d;
    --silktide-consent-manager-background-color: #ffffff;
    --silktide-consent-manager-text-color: #333333;
    --silktide-consent-manager-border-color: #dee2e6;
    --silktide-consent-manager-border-radius: 8px;
    --silktide-consent-manager-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --silktide-consent-manager-font-size: 14px;
    --silktide-consent-manager-line-height: 1.5;
    --silktide-consent-manager-z-index: 9999;
}

/* Banner Styles */
.silktide-consent-manager-banner {
    position: fixed;
    max-width: 400px;
    background: var(--silktide-consent-manager-background-color);
    border: 1px solid var(--silktide-consent-manager-border-color);
    border-radius: var(--silktide-consent-manager-border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-family: var(--silktide-consent-manager-font-family);
    font-size: var(--silktide-consent-manager-font-size);
    line-height: var(--silktide-consent-manager-line-height);
    color: var(--silktide-consent-manager-text-color);
    z-index: var(--silktide-consent-manager-z-index);
    display: none;
    padding: 20px;
    margin: 20px;
}

.silktide-consent-manager-banner--visible {
    display: block;
}

.silktide-consent-manager-banner--bottomLeft {
    bottom: 0;
    left: 0;
}

.silktide-consent-manager-banner--bottomRight {
    bottom: 0;
    right: 0;
}

.silktide-consent-manager-banner--bottomCenter {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.silktide-consent-manager-banner--center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.silktide-consent-manager-banner__content {
    position: relative;
}

.silktide-consent-manager-banner__title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.silktide-consent-manager-banner__description {
    margin: 0 0 20px 0;
    color: var(--silktide-consent-manager-secondary-color);
}

.silktide-consent-manager-banner__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.silktide-consent-manager-banner__button {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: var(--silktide-consent-manager-font-size);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    outline: none;
}

.silktide-consent-manager-banner__button:focus {
    outline: 2px solid var(--silktide-consent-manager-primary-color);
    outline-offset: 2px;
}

.silktide-consent-manager-banner__button--accept {
    background: var(--silktide-consent-manager-primary-color);
    color: white;
}

.silktide-consent-manager-banner__button--accept:hover {
    background: #0056b3;
}

.silktide-consent-manager-banner__button--reject {
    background: var(--silktide-consent-manager-secondary-color);
    color: white;
}

.silktide-consent-manager-banner__button--reject:hover {
    background: #545b62;
}

.silktide-consent-manager-banner__button--preferences {
    background: transparent;
    color: var(--silktide-consent-manager-primary-color);
    border: 1px solid var(--silktide-consent-manager-primary-color);
}

.silktide-consent-manager-banner__button--preferences:hover {
    background: var(--silktide-consent-manager-primary-color);
    color: white;
}

.silktide-consent-manager-banner__close {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    border: none;
    background: var(--silktide-consent-manager-secondary-color);
    color: white;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.silktide-consent-manager-banner__close:hover {
    background: #545b62;
}

.silktide-consent-manager-banner__close:focus {
    outline: 2px solid var(--silktide-consent-manager-primary-color);
    outline-offset: 2px;
}

/* Modal Styles */
.silktide-consent-manager-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: calc(var(--silktide-consent-manager-z-index) + 1);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.silktide-consent-manager-modal--visible {
    display: flex;
}

.silktide-consent-manager-modal__content {
    background: var(--silktide-consent-manager-background-color);
    border-radius: var(--silktide-consent-manager-border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 550px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
    margin: auto;
    font-family: var(--silktide-consent-manager-font-family);
    font-size: var(--silktide-consent-manager-font-size);
    line-height: var(--silktide-consent-manager-line-height);
    color: var(--silktide-consent-manager-text-color);
    box-sizing: border-box;
}

.silktide-consent-manager-modal__title {
    margin: 0 0 15px 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
}

.silktide-consent-manager-modal__description {
    margin: 0 0 25px 0;
    color: var(--silktide-consent-manager-secondary-color);
}

.silktide-consent-manager-modal__cookie-types {
    margin: 0 0 30px 0;
}

.silktide-consent-manager-modal__cookie-type {
    padding: 20px;
    border: 1px solid var(--silktide-consent-manager-border-color);
    border-radius: var(--silktide-consent-manager-border-radius);
    margin-bottom: 15px;
}

.silktide-consent-manager-modal__cookie-type:last-child {
    margin-bottom: 0;
}

.silktide-consent-manager-modal__cookie-type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.silktide-consent-manager-modal__cookie-type-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.silktide-consent-manager-modal__cookie-type-description {
    margin: 0;
    color: var(--silktide-consent-manager-secondary-color);
    font-size: 13px;
}

.silktide-consent-manager-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.silktide-consent-manager-modal__button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: var(--silktide-consent-manager-font-size);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.silktide-consent-manager-modal__button:focus {
    outline: 2px solid var(--silktide-consent-manager-primary-color);
    outline-offset: 2px;
}

.silktide-consent-manager-modal__button--accept {
    background: var(--silktide-consent-manager-primary-color);
    color: white;
}

.silktide-consent-manager-modal__button--accept:hover {
    background: #0056b3;
}

.silktide-consent-manager-modal__button--reject {
    background: var(--silktide-consent-manager-secondary-color);
    color: white;
}

.silktide-consent-manager-modal__button--reject:hover {
    background: #545b62;
}

.silktide-consent-manager-modal__button--save {
    background: #28a745;
    color: white;
}

.silktide-consent-manager-modal__button--save:hover {
    background: #218838;
}

.silktide-consent-manager-modal__close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--silktide-consent-manager-secondary-color);
    color: white;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.silktide-consent-manager-modal__close:hover {
    background: #545b62;
}

.silktide-consent-manager-modal__close:focus {
    outline: 2px solid var(--silktide-consent-manager-primary-color);
    outline-offset: 2px;
}

/* Switch Styles */
.silktide-consent-manager-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.silktide-consent-manager-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.silktide-consent-manager-switch__slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 24px;
    transition: 0.3s;
}

.silktide-consent-manager-switch__slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.silktide-consent-manager-switch input:checked + .silktide-consent-manager-switch__slider {
    background-color: var(--silktide-consent-manager-primary-color);
}

.silktide-consent-manager-switch input:checked + .silktide-consent-manager-switch__slider:before {
    transform: translateX(26px);
}

.silktide-consent-manager-switch input:disabled + .silktide-consent-manager-switch__slider {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.silktide-consent-manager-switch input:disabled + .silktide-consent-manager-switch__slider:before {
    background-color: #f8f9fa;
}

.silktide-consent-manager-switch input:focus + .silktide-consent-manager-switch__slider {
    outline: 2px solid var(--silktide-consent-manager-primary-color);
    outline-offset: 2px;
}

/* Cookie Icon Styles */
.silktide-consent-manager-cookie-icon {
    position: fixed;
    z-index: var(--silktide-consent-manager-z-index);
    display: none;
}

.silktide-consent-manager-cookie-icon--visible {
    display: block;
}

.silktide-consent-manager-cookie-icon--bottomLeft {
    bottom: 20px;
    left: 20px;
}

.silktide-consent-manager-cookie-icon--bottomRight {
    bottom: 20px;
    right: 20px;
}

.silktide-consent-manager-cookie-icon__button {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: var(--silktide-consent-manager-primary-color);
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.silktide-consent-manager-cookie-icon__button:hover {
    background: #0056b3;
    transform: scale(1.1);
}

.silktide-consent-manager-cookie-icon__button:focus {
    outline: 2px solid var(--silktide-consent-manager-primary-color);
    outline-offset: 2px;
}

/* Background Styles */
.silktide-consent-manager-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--silktide-consent-manager-z-index);
    display: none;
}

.silktide-consent-manager-background--visible {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .silktide-consent-manager-banner {
        max-width: none;
        width: calc(100% - 40px);
        margin: 20px;
    }
    
    .silktide-consent-manager-banner--bottomLeft,
    .silktide-consent-manager-banner--bottomRight,
    .silktide-consent-manager-banner--bottomCenter {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .silktide-consent-manager-modal__content {
        margin: 15px;
        width: calc(100% - 30px);
        max-width: none;
        max-height: calc(100vh - 30px);
        padding: 20px;
        border-radius: 12px;
    }
    
    .silktide-consent-manager-modal__actions {
        flex-direction: column;
    }
    
    .silktide-consent-manager-modal__button {
        width: 100%;
    }
    
    .silktide-consent-manager-modal__cookie-type-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    /* Ridimensiona icona cookie per mobile */
    .silktide-consent-manager-cookie-icon__button {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .silktide-consent-manager-cookie-icon--bottomLeft {
        bottom: 15px;
        left: 15px;
    }
    
    .silktide-consent-manager-cookie-icon--bottomRight {
        bottom: 15px;
        right: 15px;
    }
}

/* Ottimizzazione per schermi molto piccoli (telefoni) */
@media (max-width: 480px) {
    .silktide-consent-manager-cookie-icon__button {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .silktide-consent-manager-cookie-icon--bottomLeft {
        bottom: 10px;
        left: 10px;
    }
    
    .silktide-consent-manager-cookie-icon--bottomRight {
        bottom: 10px;
        right: 10px;
    }
    
    /* Modal ottimizzato per telefoni */
    .silktide-consent-manager-modal {
        padding: 10px;
    }
    
    .silktide-consent-manager-modal__content {
        margin: 10px;
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        padding: 15px;
        border-radius: 8px;
    }
    
    .silktide-consent-manager-modal__title {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .silktide-consent-manager-modal__description {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .silktide-consent-manager-modal__cookie-type {
        padding: 15px;
        margin-bottom: 10px;
    }
    
    .silktide-consent-manager-modal__cookie-type-name {
        font-size: 14px;
    }
    
    .silktide-consent-manager-modal__cookie-type-description {
        font-size: 12px;
    }
    
    .silktide-consent-manager-modal__button {
        padding: 10px 15px;
        font-size: 13px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .silktide-consent-manager-banner,
    .silktide-consent-manager-modal,
    .silktide-consent-manager-cookie-icon__button,
    .silktide-consent-manager-switch__slider,
    .silktide-consent-manager-switch__slider:before {
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .silktide-consent-manager-banner,
    .silktide-consent-manager-modal__content {
        border-width: 2px;
    }
    
    .silktide-consent-manager-banner__button,
    .silktide-consent-manager-modal__button {
        border-width: 2px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --silktide-consent-manager-background-color: #2d3748;
        --silktide-consent-manager-text-color: #e2e8f0;
        --silktide-consent-manager-border-color: #4a5568;
        --silktide-consent-manager-secondary-color: #a0aec0;
    }
}