/* Overlay di sfondo */
.ccm-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.ccm-overlay.ccm-overlay-visible {
    display: flex;
}

.ccm-consent-box.ccm-position-top {
    align-self: flex-start;
}

/* Box principale */
.ccm-consent-box {
    width: 100%;
    max-width: 980px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* Barra delle tab */
.ccm-tabs {
    display: flex;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.ccm-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 18px 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    border-bottom: 3px solid transparent;
    transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    font-family: inherit;
}

.ccm-tab:hover {
    opacity: 0.85;
}

.ccm-tab.ccm-tab-active {
    opacity: 1;
    color: var(--ccm-accent, #2f8fe8);
    border-bottom-color: var(--ccm-accent, #2f8fe8);
}

/* Contenuto delle tab */
.ccm-tab-panels {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.ccm-tab-panel {
    display: none;
}

.ccm-tab-panel.ccm-panel-active {
    display: block;
    animation: ccm-fade-in 0.15s ease;
}

@keyframes ccm-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ccm-tab-panel h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
}

.ccm-tab-panel p {
    margin: 0 0 14px 0;
    font-size: 14.5px;
    line-height: 1.6;
    opacity: 0.9;
}

.ccm-tab-panel p:last-child {
    margin-bottom: 0;
}

.ccm-tab-panel a {
    color: var(--ccm-accent, #2f8fe8);
    text-decoration: underline;
    font-weight: 600;
}

/* Categorie (tab Dettagli) */
.ccm-category {
    border-top: 1px solid rgba(0,0,0,0.1);
    padding: 14px 0;
}

.ccm-category:first-child {
    border-top: none;
    padding-top: 0;
}

.ccm-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
}

.ccm-switch-row span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ccm-switch-row small {
    opacity: 0.65;
    font-size: 12.5px;
    line-height: 1.4;
}

.ccm-switch-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: var(--ccm-accent, #2f8fe8);
}

/* Barra dei pulsanti in fondo, sempre visibile */
.ccm-actions {
    display: flex;
    gap: 12px;
    padding: 18px 28px;
    border-top: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ccm-btn {
    flex: 1;
    min-width: 140px;
    border: none;
    border-radius: 8px;
    padding: 13px 18px;
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.15s ease;
    font-family: inherit;
}

.ccm-btn:hover {
    filter: brightness(0.94);
}

.ccm-chevron {
    display: inline-block;
    margin-left: 2px;
}

@media (max-width: 640px) {
    .ccm-tab {
        font-size: 13px;
        padding: 14px 8px;
    }
    .ccm-tab-panels {
        padding: 18px 18px;
    }
    .ccm-actions {
        padding: 14px 18px;
        flex-direction: column;
    }
    .ccm-btn {
        width: 100%;
    }
}

/* Icona flottante per riaprire le preferenze */
.ccm-floating-icon {
    position: fixed;
    bottom: 20px;
    z-index: 999998;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
}

.ccm-floating-icon:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}

.ccm-floating-icon.ccm-icon-bottom-right {
    right: 20px;
}

.ccm-floating-icon.ccm-icon-bottom-left {
    left: 20px;
}

.ccm-floating-icon.ccm-icon-visible {
    display: flex;
}

@media (max-width: 600px) {
    .ccm-floating-icon {
        width: 46px;
        height: 46px;
        bottom: 16px;
    }
    .ccm-floating-icon.ccm-icon-bottom-right {
        right: 16px;
    }
    .ccm-floating-icon.ccm-icon-bottom-left {
        left: 16px;
    }
}
