/**
 * GS Consent & Privacy - Stylesheet
 * Version: 1.0.0
 * Author: Giulio Soligo
 */

/* ==========================================================================
   Banner Principale (Informativa Breve)
   ========================================================================== */
#gs-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    background: #ffffff;
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.15);
    border-top: 3px solid #007209;
    padding: 24px 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #2c3e50;
    display: none;
    box-sizing: border-box;
}

#gs-consent-banner.gs-visible {
    display: block;
    animation: gsSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes gsSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.gs-consent-inner {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    padding-right: 35px;
}

.gs-consent-close-btn {
    position: absolute;
    top: -8px;
    right: 0;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #7f8c8d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    padding: 0;
}

.gs-consent-close-btn:hover {
    background: #f1f2f6;
    color: #2c3e50;
}

.gs-consent-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.gs-consent-header svg {
    flex-shrink: 0;
}

.gs-consent-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a252f;
    letter-spacing: -0.2px;
}

.gs-consent-body p {
    font-size: 14px;
    line-height: 1.55;
    margin: 0 0 16px 0;
    color: #4a5568;
}

.gs-consent-body a {
    color: #007209;
    text-decoration: underline;
    font-weight: 600;
}

.gs-consent-body a:hover {
    color: #005006;
}

.gs-consent-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

/* Pulsanti con pari dignita visiva (Linee Guida Garante 2021) */
.gs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: 2px solid transparent;
    line-height: 1.2;
    min-height: 42px;
    box-sizing: border-box;
}

.gs-btn-accept {
    background-color: #007209;
    color: #ffffff !important;
    border-color: #007209;
}

.gs-btn-accept:hover {
    background-color: #005a07;
    border-color: #005a07;
    color: #ffffff !important;
}

.gs-btn-reject {
    background-color: #2d3748;
    color: #ffffff !important;
    border-color: #2d3748;
}

.gs-btn-reject:hover {
    background-color: #1a202c;
    border-color: #1a202c;
    color: #ffffff !important;
}

.gs-btn-customize {
    background-color: transparent;
    color: #2d3748 !important;
    border-color: #cbd5e0;
}

.gs-btn-customize:hover {
    background-color: #f7fafc;
    border-color: #a0aec0;
    color: #1a202c !important;
}

/* ==========================================================================
   Modale Preferenze Granulari
   ========================================================================== */
#gs-consent-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

#gs-consent-modal-overlay.gs-visible {
    display: flex;
    animation: gsFadeIn 0.25s ease forwards;
}

@keyframes gsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.gs-consent-modal {
    background: #ffffff;
    border-radius: 12px;
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #2c3e50;
    animation: gsScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes gsScaleUp {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.gs-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gs-modal-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: #1a252f;
}

.gs-modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.gs-modal-desc {
    margin-bottom: 20px;
    color: #4a5568;
}

.gs-category-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    background: #ffffff;
    transition: border-color 0.2s;
}

.gs-category-card:hover {
    border-color: #cbd5e0;
}

.gs-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.gs-category-title {
    font-weight: 700;
    font-size: 15px;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gs-badge-always-active {
    font-size: 12px;
    font-weight: 600;
    color: #007209;
    background: #e8f5e9;
    padding: 4px 10px;
    border-radius: 12px;
}

.gs-category-body p {
    margin: 0;
    font-size: 13px;
    color: #718096;
    line-height: 1.5;
}

/* Switch / Toggle Switch */
.gs-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.gs-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e0;
    transition: 0.2s;
    border-radius: 24px;
}

.gs-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked + .gs-slider {
    background-color: #007209;
}

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

input:disabled + .gs-slider {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #007209;
}

.gs-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #edf2f7;
    background: #f8fafc;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gs-modal-footer-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

/* ==========================================================================
   Badge Flottante di Riapertura ("Gestisci Consenso")
   ========================================================================== */
#gs-consent-badge {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999990;
    width: 44px;
    height: 44px;
    background-color: #007209;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    padding: 0;
}

#gs-consent-badge:hover {
    transform: scale(1.1);
    background-color: #005a07;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#gs-consent-badge svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* Tooltip badge */
#gs-consent-badge::after {
    content: "Preferenze Cookie & Privacy";
    position: absolute;
    left: 54px;
    background: #1a252f;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#gs-consent-badge:hover::after {
    opacity: 1;
}

/* ==========================================================================
   Shortcode Documentale & Tabella Cookie (Privacy & Cookie Policy)
   ========================================================================== */
.gs-legal-container {
    max-width: 900px;
    margin: 30px auto;
    font-family: inherit;
    color: #2c3e50;
    line-height: 1.7;
}

.gs-legal-container h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1a252f;
    margin-top: 36px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #edf2f7;
}

.gs-legal-container h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-top: 24px;
    margin-bottom: 10px;
}

.gs-legal-container p, .gs-legal-container ul {
    margin-bottom: 16px;
}

.gs-legal-container ul {
    padding-left: 24px;
}

.gs-legal-container li {
    margin-bottom: 8px;
}

.gs-consent-status-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #007209;
    padding: 18px 22px;
    border-radius: 8px;
    margin: 24px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.gs-consent-status-info h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: #1a252f;
}

.gs-consent-status-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gs-status-pill {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.gs-status-pill.active {
    background: #e8f5e9;
    color: #007209;
}

.gs-status-pill.inactive {
    background: #f1f2f6;
    color: #747d8c;
}

/* Tabella Cookie */
.gs-cookie-table-wrapper {
    overflow-x: auto;
    margin: 24px 0;
}

.gs-cookie-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.5;
}

.gs-cookie-table th, .gs-cookie-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}

.gs-cookie-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #2d3748;
    border-top: 1px solid #edf2f7;
}

.gs-cookie-table tr:hover td {
    background: #fafbfc;
}

/* Responsive */
@media (max-width: 768px) {
    #gs-consent-banner {
        padding: 18px 14px;
    }
    .gs-consent-inner {
        padding-right: 0;
    }
    .gs-consent-close-btn {
        top: -6px;
        right: -6px;
    }
    .gs-consent-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .gs-btn {
        width: 100%;
        text-align: center;
    }
    .gs-modal-footer-actions {
        flex-direction: column;
        width: 100%;
    }
    #gs-consent-badge {
        bottom: 15px;
        left: 15px;
        width: 38px;
        height: 38px;
    }
    #gs-consent-badge::after {
        display: none;
    }
}
