/* BASE STYLES */
#cookie-banner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    display: none;
}

#cookie-banner-overlay.show { 
    display: flex;
}

#cookie-banner {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    max-width: 500px;
    width: 90%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.cookie-simple-view,
.cookie-advanced-view {
    max-height: 95vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Nasconde la scrollbar ma mantiene la funzionalità */
.cookie-simple-view::-webkit-scrollbar,
.cookie-advanced-view::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

.cookie-simple-view,
.cookie-advanced-view {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* DARK THEME */
#cookie-banner-overlay.cookie-theme-dark #cookie-banner {
    background: #1a1a1a;
    color: #fff;
}

#cookie-banner-overlay.cookie-theme-dark .cookie-simple-view h3,
#cookie-banner-overlay.cookie-theme-dark .cookie-advanced-view h3,
#cookie-banner-overlay.cookie-theme-dark .cookie-category-title {
    color: #fff;
}

#cookie-banner-overlay.cookie-theme-dark .cookie-simple-view p,
#cookie-banner-overlay.cookie-theme-dark .cookie-advanced-view > p,
#cookie-banner-overlay.cookie-theme-dark .cookie-category-content,
#cookie-banner-overlay.cookie-theme-dark .cookie-link {
    color: #ccc;
}

#cookie-banner-overlay.cookie-theme-dark .cookie-category {
    background: #2a2a2a;
    border-color: #444;
}

#cookie-banner-overlay.cookie-theme-dark .cookie-btn-secondary {
    background: #333;
    color: #fff;
}

#cookie-banner-overlay.cookie-theme-dark .cookie-btn-secondary:hover {
    background: #444;
}

#cookie-banner-overlay.cookie-theme-dark .cookie-back-btn {
    color: #64B5F6;
}

/* CONTENT STYLES */
.cookie-simple-view {
    padding: 24px 32px 0 32px;
    text-align: center;
}

.cookie-simple-view h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.cookie-simple-view p {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    text-align: justify;
}

.cookie-advanced-view {
    display: none;
    padding: 24px 32px 0 32px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.cookie-advanced-view.show {
    display: block;
}

.cookie-advanced-view h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
}

.cookie-advanced-view > p {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    text-align: justify;
}

.cookie-category {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 8px;
    background: #fafafa;
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}

.cookie-category-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    flex: 1;
}

.cookie-category-arrow {
    font-size: 12px;
    color: #999;
    transition: transform 0.2s;
    margin-right: 8px;
}

.cookie-category.expanded .cookie-category-arrow {
    transform: rotate(180deg);
}

.cookie-category-status {
    font-size: 13px;
    color: #4CAF50;
    font-weight: 500;
}

.cookie-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

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

.cookie-toggle input:checked + .cookie-toggle-slider {
    background-color: #2196F3;
}

.cookie-toggle input:checked + .cookie-toggle-slider:before {
    transform: translateX(20px);
}

.cookie-category-content {
    display: none;
    padding: 0 16px 14px 16px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.cookie-category.expanded .cookie-category-content {
    display: block;
}

.cookie-btn {
    width: 100%;
    padding: 11px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.cookie-btn-primary {
    background: #2196F3;
    color: white;
}

.cookie-btn-primary:hover {
    background: #1976D2;
}

.cookie-btn-secondary {
    background: #f5f5f5;
    color: #333;
    margin-top: 4px;
}

.cookie-btn-secondary:hover {
    background: #e0e0e0;
}

.cookie-link {
    display: block;
    text-align: center;
    font-size: 13px;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    padding: 8px 0 30px 0;
}

.cookie-link:hover {
    color: #333;
}

.cookie-back-btn {
    background: none;
    border: none;
    color: #2196F3;
    font-size: 14px;
    cursor: pointer;
    padding: 0 0 16px 0;
    text-decoration: underline;
}

/* BANNER FOOTER - Stile migliorato ispirato a CookieYes */
.cookie-banner-footer {
    padding: 10px 20px;
    background: #f5f5f5;
    border-top: 1px solid #e8e8e8;
    text-align: right;
    font-size: 10px;
    color: #999;
    border-radius: 0 0 8px 8px;
    flex-shrink: 0;
    width: calc(100% + 64px);
    margin-left: -32px;
    margin-right: -32px;
    margin-top: auto;
}

.cookie-banner-footer a {
    color: #999;
    text-decoration: none;
    font-weight: 500;
}

.cookie-banner-footer a:hover {
    color: #666;
    text-decoration: none;
}

/* Footer per la vista avanzata */
.cookie-advanced-view .cookie-banner-footer {
    width: calc(100% + 64px);
    margin-left: -32px;
    margin-right: -32px;
}

/* DARK THEME - Footer */
#cookie-banner-overlay.cookie-theme-dark .cookie-banner-footer {
    background: #2a2a2a;
    border-top: 1px solid #3a3a3a;
    color: #888;
}

#cookie-banner-overlay.cookie-theme-dark .cookie-banner-footer a {
    color: #888;
}

#cookie-banner-overlay.cookie-theme-dark .cookie-banner-footer a:hover {
    color: #aaa;
}