/* Base cookie banner */
.em-cookie-banner {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    z-index: 99999;
    padding: 24px 32px;
}

/* Position-specific styling */
/* Posizioni verticali */
.em-cookie-banner--bottom {
    bottom: 32px;
}

.em-cookie-banner--top {
    top: 32px;
}

.em-cookie-banner--center {
    top: 50%;
    transform: translateY(-50%);
}

/* Posizioni orizzontali */
.em-cookie-banner--left {
    left: 32px;
    transform: none;
}

.em-cookie-banner--center {
    left: 50%;
    transform: translateX(-50%);
}

.em-cookie-banner--right {
    right: 32px;
    left: auto;
    transform: none;
}

/* Combinazioni centro-centro */
.em-cookie-banner--center.em-cookie-banner--center {
    transform: translate(-50%, -50%);
}

/* Responsive */
@media (max-width: 768px) {
    .em-cookie-banner {
        width: calc(100% - 20px) !important;
        margin: 10px !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }
    
    .em-cookie-banner--center.em-cookie-banner--center {
        left: 0 !important;
        transform: translateY(-50%) !important;
    }
}

/* Banner content */
.em-cookie-banner__content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.em-cookie-banner__text {
    text-align: center;
}

.em-cookie-banner__text h3 {
    margin: 0 0 12px;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    color: #1a1a1a;
}

.em-cookie-banner__text p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #4a4a4a;
}

.em-cookie-banner__policy-link {
    color: #000000 !important; /* Nero puro */
    text-decoration: underline !important; /* Sottolineatura permanente */
    text-underline-offset: 3px; /* Spaziatura dalla linea di testo */
    text-decoration-color: rgba(0, 0, 0, 0.3); /* Colore sottolineatura più tenue */
}

.em-cookie-banner__policy-link:hover {
    color: #333333 !important; /* Nero leggermente più chiaro al passaggio del mouse */
    text-decoration-color: rgba(0, 0, 0, 0.6); /* Sottolineatura più marcata */
}

/* Banner buttons */
.em-cookie-banner__buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.em-cookie-banner__button {
    width: 100%;
    max-width: 300px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.em-cookie-banner__button--accept {
    background-color: #111111 !important;
    color: white !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Hover state */
.em-cookie-banner__button--accept:hover {
    background-color: #000000 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.em-cookie-banner__button--settings {
    background-color: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.em-cookie-banner__button--settings:hover {
    background-color: #e5e7eb;
    color: #333;
    transform: translateY(-1px);
}

/* Modal base styles */
.em-cookie-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: none;
}

.em-cookie-modal__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.em-cookie-modal__content {
    position: relative;
    background: white;
    max-width: 700px;
    margin: 40px auto;
    padding: 32px;
    border-radius: 16px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.1);
}

/* Modal header */
.em-cookie-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.em-cookie-modal__header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.em-cookie-modal__close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.em-cookie-modal__close:hover {
    color: #000;
}

/* Modal body */
.em-cookie-modal__description {
    margin: 0 0 24px;
    color: #666;
}

/* Cookie categories */
.em-cookie-category {
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.em-cookie-category__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px 8px 0 0;
}

.em-cookie-category__title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.em-cookie-category__title-group h4 {
    margin: 0;
    font-size: 1.1rem;
}

.em-cookie-category__required-badge {
    background: #e5e7eb;
    color: #4b5563;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Cookie switches */
.em-cookie-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.em-cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.em-cookie-switch__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #e5e7eb;
    transition: .4s;
    border-radius: 34px;
}

.em-cookie-switch__slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.em-cookie-switch input:checked + .em-cookie-switch__slider {
    background-color: #2563eb;
}

.em-cookie-switch input:checked + .em-cookie-switch__slider:before {
    transform: translateX(24px);
}

/* Cookie list */
.em-cookie-category__content {
    padding: 16px;
}

.em-cookie-category__description {
    margin: 0 0 16px;
    color: #666;
}

.em-cookie-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.em-cookie-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #f9fafb;
    border-radius: 4px;
}

.em-cookie-item__header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.em-cookie-item__name {
    font-weight: 500;
    font-size: 14px !important;
}

/* Modal footer */
.em-cookie-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.em-cookie-modal__button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.em-cookie-modal__button--save {
    background-color: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.em-cookie-modal__button--accept-all {
    background-color: #2563eb;
    color: white;
}

/* Cookie info modal */
.em-cookie-info-modal {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: none;
}


.em-cookie-info-modal__close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.em-cookie-info-modal__close:hover {
    color: #000;
}

.em-cookie-info-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.em-cookie-info-modal__content {
    position: relative;
    background: white;
    max-width: 400px;
    margin: 20vh auto 0;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.em-cookie-info-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.em-cookie-info-modal__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.em-cookie-info-modal__detail {
    margin-bottom: 12px;
}

.em-cookie-info-modal__detail strong {
    display: block;
    margin-bottom: 4px;
    color: #4b5563;
}

/* Responsive styles */
@media (max-width: 768px) {
    .em-cookie-banner {
        width: calc(100% - 20px);
        margin: 0 10px;
        padding: 20px;
    }

    .em-cookie-banner__buttons {
        width: 100%;
    }

    .em-cookie-banner__button {
        max-width: 100%;
    }
}

/* Animations */
@keyframes slideUpFromBottom {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes slideDownFromTop {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.em-cookie-banner--bottom {
    animation: slideUpFromBottom 0.5s ease-out;
}

.em-cookie-banner--top {
    animation: slideDownFromTop 0.5s ease-out;
}


.em-cookie-banner--center {
    position: fixed;
    top: 50%;
    bottom: auto;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    max-width: 90%;
    width: 600px; /* Larghezza predefinita */
}

/* Rimuovi le animazioni precedenti */
.em-cookie-banner--bottom,
.em-cookie-banner--top {
    animation: none;
}

@keyframes fadeInCenter {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.em-cookie-banner--center {
    animation: fadeInCenter 0.3s ease-out;
}

/* Assicurati che il banner al centro sia centrato anche su schermi più piccoli */
@media (max-width: 768px) {
    .em-cookie-banner--center {
        width: calc(100% - 20px);
        max-width: 95%;
    }
}


/* Floating Cookie Button */
.em-cookie-preferences-button {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 99998;
    transition: all 0.3s ease;
}

.em-cookie-preferences-button {
    display: none;
}

.em-cookie-preferences-button.show {
    display: block;
}

.em-cookie-preferences-button.show {
    opacity: 1;
    visibility: visible;
}

.em-cookie-preferences-button button {
    width: 47px;
    height: 47px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s ease;
    padding: 5px;
}

.em-cookie-preferences-button button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    color: #000;
}

/* Animazione quando appare */
@keyframes floatingButtonIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.em-cookie-preferences-button.show {
    animation: floatingButtonIn 0.3s ease forwards;
}

.em-cookie-category__toggle, .em-cookie-modal__close, .em-cookie-info-modal__close{
    padding: 5px 5px 0 5px!important;
    transition: all 0.2s ease;
    cursor: pointer;
}

.em-cookie-info-button, .em-cookie-info-button:hover, .em-cookie-info-button:focus{
    padding: 0!important;
    border: none !important;
}