/* GLIDE Engineering - Cookie Banner CSS Mobile-First */

/* BANNER PRINCIPALE - Mobile First */
.cookie-banner-light {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    max-width: calc(100vw - 2rem);
    
    background-color: rgba(26, 23, 50, 0.95);
    border: 1.5px solid var(--accent-color);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.3), 
                0 0 0 1px rgba(235, 6, 140, 0.2);
    
    z-index: 9999;
    font-family: 'Montserrat', sans-serif;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    display: none;
    animation: slideIn 0.3s ease-out;
    transition: all 0.3s ease-out;
}

/* CONTENUTO BANNER */
.cookie-banner-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cookie-banner-light p {
    color: var(--white);
    font-size: clamp(0.8125rem, 2.5vw, 0.875rem);
    margin: 0;
    line-height: 1.4;
}

.cookie-banner-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: clamp(0.75rem, 2vw, 0.8125rem);
}

.cookie-banner-light a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.cookie-banner-light a:hover {
    color: #FF60C0;
    text-shadow: 0 0 0.5rem rgba(235, 6, 140, 0.4);
}

/* PULSANTI */
.cookie-banner-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.cookie-btn {
    padding: 0.625rem 1rem;
    border-radius: 0.375rem;
    border: none;
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(0.8125rem, 2.5vw, 0.875rem);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 2.5rem;
    width: 100%;
    text-align: center;
}

/* Stili pulsanti */
.cookie-btn.accept {
    background-color: var(--accent-color);
    color: white;
}

.cookie-btn.accept:hover {
    background-color: #FF2AA6;
    transform: translateY(-1px);
    box-shadow: 0 0.125rem 0.375rem rgba(235, 6, 140, 0.4);
}

.cookie-btn.reject {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.cookie-btn.reject:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.cookie-btn.customize {
    background-color: rgba(235, 6, 140, 0.08);
    color: white;
    border: 1px solid rgba(235, 6, 140, 0.6);
}

.cookie-btn.customize:hover {
    background-color: rgba(235, 6, 140, 0.15);
}

/* BANNER MINIMIZZATO */
.cookie-banner-light.minimized {
    left: 1rem;
    right: auto;
    bottom: 1rem;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: minimizeIn 0.3s ease-out;
}

.cookie-banner-light.minimized:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0.3125rem 0.75rem rgba(235, 6, 140, 0.4);
}

.cookie-banner-light.minimized .cookie-banner-content {
    display: none;
}

/* ICONA COOKIE */
.cookie-icon {
    display: none;
    color: var(--accent-color);
    font-size: 1.25rem;
}

.cookie-banner-light.minimized .cookie-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* ANIMAZIONI */
@keyframes slideIn {
    from {
        transform: translateY(1.25rem);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes minimizeIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* MODAL SETTINGS */
#cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s;
    padding: 1rem;
}

#cookie-settings-modal.visible {
    opacity: 1;
}

.modal-content {
    background-color: white;
    color: #333;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 60rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    box-shadow: 0 0.625rem 2rem rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s forwards;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(1.25rem);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* MODAL HEADER */
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 1;
}

.modal-header h2 {
    font-size: clamp(1.25rem, 4vw, 1.625rem);
    margin-bottom: 0.75rem;
    color: #333;
    font-weight: 600;
}

.modal-header p {
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    color: #666;
    line-height: 1.6;
}

/* MODAL TABS */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background-color: white;
    position: sticky;
    top: 0;
    z-index: 1;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-tab {
    padding: 1rem 1.5rem;
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    font-weight: 500;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.modal-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.modal-tab:hover:not(.active) {
    background-color: #f9f9f9;
}

/* TAB CONTENT */
.cookie-tab-content {
    padding: 1.5rem;
    display: none;
}

.cookie-tab-content.active {
    display: block;
}

/* COOKIE CATEGORIES */
.cookie-category {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.cookie-category:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.cookie-category-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.cookie-category-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f2f2f2;
    border-radius: 50%;
    color: #666;
    flex-shrink: 0;
}

.cookie-category-title {
    font-size: clamp(1rem, 3vw, 1.125rem);
    font-weight: 600;
    color: #333;
}

.cookie-category-description {
    font-size: clamp(0.8125rem, 2.5vw, 0.9375rem);
    color: #666;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

/* TOGGLE SWITCH */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.625rem;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 1.625rem;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 1.125rem;
    width: 1.125rem;
    left: 0.25rem;
    bottom: 0.25rem;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background-color: var(--accent-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(1.375rem);
}

input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* COOKIE DETAILS */
.cookie-details {
    font-size: clamp(0.8125rem, 2.5vw, 0.9375rem);
}

.cookie-details-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    user-select: none;
    color: var(--accent-color);
}

.cookie-details-arrow {
    transition: transform 0.3s;
}

.cookie-details-arrow.expanded {
    transform: rotate(90deg);
}

.cookie-table-container {
    display: none;
    margin-top: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cookie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(0.75rem, 2vw, 0.875rem);
}

.cookie-table th,
.cookie-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.cookie-table th {
    color: #333;
    font-weight: 600;
    white-space: nowrap;
}

.cookie-table td {
    color: #666;
}

.cookie-table tr:last-child td {
    border-bottom: none;
}

/* MODAL FOOTER */
.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #e0e0e0;
    background-color: white;
    position: sticky;
    bottom: 0;
}

.modal-footer-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.close-modal-btn {
    color: #666;
    border: none;
    background: none;
    font-size: clamp(0.875rem, 2.5vw, 0.9375rem);
    cursor: pointer;
    padding: 0.5rem;
    font-family: 'Montserrat', sans-serif;
}

.close-modal-btn:hover {
    color: #333;
    text-decoration: underline;
}

/* TABLET ADJUSTMENTS */
@media (min-width: 48rem) {
    /* Banner positioning */
    .cookie-banner-light {
        bottom: 1.5rem;
        right: 1.5rem;
        left: auto;
        max-width: 28rem;
        padding: 1.25rem 1.5rem;
    }
    
    /* Buttons side by side */
    .cookie-banner-buttons {
        flex-direction: row;
        justify-content: flex-end;
    }
    
    .cookie-btn {
        width: auto;
        padding: 0.5rem 1.25rem;
    }
    
    /* Modal footer */
    .modal-footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .modal-footer-buttons {
        flex-direction: row;
        width: auto;
    }
    
    /* Category description with indent */
    .cookie-category-description {
        padding-left: 2.75rem;
    }
}

/* DESKTOP ADJUSTMENTS */
@media (min-width: 64rem) {
    .cookie-banner-light {
        max-width: 30rem;
        padding: 1.5rem 2rem;
    }
    
    .modal-header {
        padding: 2rem 2.5rem;
    }
    
    .modal-tab {
        padding: 1.125rem 2rem;
    }
    
    .cookie-tab-content {
        padding: 2.5rem;
    }
    
    .modal-footer {
        padding: 1.75rem 2.5rem;
    }
}

/* HEIGHT-BASED ADJUSTMENTS */
@media (max-height: 40rem) {
    .modal-content {
        max-height: calc(100vh - 1rem);
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .cookie-tab-content {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
    }
}

/* FOCUS STYLES */
.cookie-btn:focus-visible,
.modal-tab:focus-visible,
.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* PRINT STYLES */
@media print {
    .cookie-banner-light,
    #cookie-settings-modal {
        display: none !important;
    }
}