/**
 * Plugin Name: Cookie Consent v2
 * Description: GDPR compliant cookie consent banner with Google Consent Mode v2 integration.
 * Version: 3.1.0
 * Author: Bogdan Păunică
 */
 
 /* Basic styling for the cookie consent banner */
#cookie-consent-v2-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #f0f0f0;
    padding: 20px;
    z-index: 9999;
    /* NEW: Flexbox for centering */
    display: flex;
    flex-direction: column; /* Stack content vertically */
    align-items: center; /* Center horizontally */
    box-shadow: 0px -2px 5px rgba(0,0,0,0.2);
    /*teste de afisare corecta*/

}

.cookie-banner-title {
    color:white;
    background-color: #007bff;
    padding:1em 2em;
    
}

#cookie-consent-v2-banner-text {
    max-height:360px;
    overflow-y:scroll;
}

#cookie-consent-v2-banner p {
    margin-bottom: 10px;
    text-align: center; /* Center the paragraph text */
    font-size:1em;
}

/* NEW: Container for buttons */
.cookie-consent-v2-buttons {
    display: flex;
    justify-content: center; /* Center buttons horizontally */
    gap: 10px; /* Space between buttons */
    flex-direction: row; /* Buttons in a row */
    justify-content: center; /* Center buttons horizontally */
    margin-top: 10px; /* Add some space above the buttons */
    width:100%;
}


#cookie-consent-v2-banner button {
    margin-top:1em;
    margin-bottom:1em;
    padding: 20px;
    border: none;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    width:100%;
}

#cookie-consent-v2-banner button.link-button {
    padding: 4px 6px;
    border: none;
    background:none;
    color: #007bff;
    cursor: pointer;
    margin:0;
    font-weight:200;
}

#cookie-consent-v2-banner ul {
    font-size: 0.9em; /* Smaller font */
    text-align: left; /* Align left */
    margin-left: 0.4em; /* Add some space from the left */
    padding-left: 1em; /* Extra padding */
    list-style-type: disc; /* Bullet points */
}

#cookie-consent-v2-banner ul li {
    margin-bottom: 0.5em; /* Space between list items */
    line-height: 1.4; /* Better readability */
}



/* Style for the button */
#cookie-consent-v2-preferences-button-duplicate {
    padding: 0 1.5em; /* Adds horizontal padding for space on the sides */
    height: 3em; /* Sets the height of the button */
    background-color: rgba(144, 238, 144, 0.6); /* Light green background with transparency */
    color: white; /* White text color */
    font-size: 1em; /* Text size */
    font-weight: bold; /* Bold text */
    border: none; /* No border */
    border-radius: 20px; /* Rounded corners */
    display: flex;
    align-items: center; /* Vertically centers text */
    justify-content: center; /* Horizontally centers text */
    position: fixed; /* Fixes the position at the bottom */
    bottom: 1em; /* 2em from the bottom of the screen */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Adds a small shadow for a floating effect */
    cursor: pointer; /* Changes the cursor to a pointer on hover */
    transition: background-color 0.3s ease; /* Smooth transition for background color */
}

#cookie-consent-v2-preferences-button-duplicate:hover {
    background-color: rgba(144, 238, 144, 0.99); /* Slightly more opaque on hover */
}


/* Change preferences banner (Modal) */

/* background */
#cookie-consent-v2-preferences-modal {
    display: none; /* Keeps the modal hidden by default */
    position: fixed;
    bottom: 0; /* Places the modal at the bottom of the screen */
    left: 0;
    width: 100%; /* Makes the modal take up the full width of the screen */
    min-height: 45%; /* Ensures the modal is at least 45% of the screen height */
    background-color: white;
    padding: 20px;
    border: none;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1); /* Adds a shadow at the top */
    z-index: 10000; /* Ensures it's above other content */
    display: flex;
    flex-direction: column; /* Makes the modal content stack vertically */
    justify-content: flex-end; /* Ensures the button stays at the bottom */
}

/* Modal content */
#cookie-consent-v2-preferences-modal .modal-content {
    flex-grow: 1; /* Allow content to expand and take available space */
    overflow-y: auto; /* Makes content scrollable if it overflows */
    padding-bottom: 60px; /* Space for the "Save Preferences" button */
}

/* Close button */
#cookie-consent-v2-preferences-modal .close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
}

/* Style for the "Save Preferences" button */
#cookie-consent-v2-preferences-modal #cookie-consent-v2-save-preferences {
    padding: 10px 20px;
    background-color: lightgreen;
    border: none;
    color: white;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px; /* Adds space above the button */
    align-self: center; /* Centers the button horizontally */
    margin-bottom: 20px; /* Adds space from the bottom */
}

/* Show when the modal is open */
#cookie-consent-v2-preferences-modal.show {
    display: flex; /* Modal is visible with flex layout */
}


/* Media Query for screens wider than 640px (Desktop) */
@media (min-width: 640px) {
    #cookie-consent-v2-banner, 
    #cookie-consent-v2-preferences-modal {
        left: auto; /* Remove the left alignment */
        right: 0; /* Align them to the right */
        width: 480px; /* Set width to 480px on desktop */
        margin-right: 20px; margin-bottom:20px; /* Optional: Adds a small gap from the right and bottom edge */
    }
    #cookie-consent-v2-preferences-button-duplicate {right:1em !important;}
}

/* Media Query for screens wider than 640px (Desktop) */
@media (max-width: 640px) {
    #cookie-consent-v2-preferences-button-duplicate {left:1em !important;}
}
