/**
 * Plugin Name: BP Cookie Consent v2
 * Description: GDPR compliant cookie consent banner with Google Consent Mode v2 integration.
 * Version: 5.1.0
 * Author: Bogdan Păunică
 */

*,
*::before,
*::after {
    box-sizing: border-box;
}

.clear {
    clear: both;
    height: 1px;
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Basic styling for the cookie consent banner */
#cookie-consent-v2-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 480px;
    background-color: #f0f0f0;
    padding: 20px;
    z-index: 9998;
    box-shadow: 0px -2px 5px rgba(0, 0, 0, 0.2);
    max-height: 80vh;
    box-sizing: border-box;
    
    display: flex;
    flex-direction: column; /* Makes elements stack vertically */
}


/* Desktop adjustments */
@media (min-width: 640px) {
    #cookie-consent-v2-banner {
        position: fixed;
        width: 480px;
        right: 20px;
        bottom: 20px;
        left: auto;
    }
}

/* Title - fixed height */
#cookie-consent-v2-banner-title {
    background-color: #007bff;
    color: white;
    text-align: center;
    padding: 1em;
    font-weight: bold;
    height: 50px; /* Fixed height */
}

.cookie-banner-title {
    margin: 0;
    font-size: 1.2em;
}

/* Scrollable text - takes remaining space */
#cookie-consent-v2-banner-text {
    overflow-y: auto;
    padding: 10px;
    flex-grow: 1; /* Allows text area to take up remaining space */
    min-height: 50px; /* Prevents it from disappearing */
}


/* Centered text inside the banner */
#cookie-consent-v2-banner p {
    margin-bottom: 10px;
    text-align: center;
    font-size: 1em;
}

/* Links section - uniform styling for links & button */
.cookie-consent-v2-links {
    text-align: center;
    margin: 10px 0;
}

.cookie-consent-v2-links .link-button {
    display: inline-block;
    padding: 8px 12px;
    color: #007bff;
    text-decoration: none;
    font-size: 0.9em;
    border: 1px solid #007bff;
    background: none;
    cursor: pointer;
    margin: 5px;
}

.cookie-consent-v2-links .link-button:hover {
    background-color: #007bff;
    color: white;
}

/* Buttons section */
.cookie-consent-v2-buttons {
    text-align: center;
    margin-top: 10px;
}

#cookie-consent-v2-reject-button,
#cookie-consent-v2-accept-button {
    display: inline-block;
    width: 48%;
    padding: 10px;
    border: none;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    font-size: 1em;
}

#cookie-consent-v2-reject-button:hover,
#cookie-consent-v2-accept-button:hover {
    background-color: #0056b3;
}

/* List styling */
#cookie-consent-v2-banner ul {
    font-size: 0.9em;
    text-align: left;
    margin-left: 0.4em;
    padding-left: 1em;
    list-style-type: disc;
}

#cookie-consent-v2-banner ul li {
    margin-bottom: 0.5em;
    line-height: 1.4;
}

/* Preferences button */
#cookie-consent-v2-preferences-button-duplicate {
    padding: 0 1.5em;
    height: 3em;
    background-color: rgba(144, 238, 144, 0.6);
    color: white;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 1em;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#cookie-consent-v2-preferences-button-duplicate:hover {
    background-color: rgba(144, 238, 144, 0.99);
}

#cookie-consent-v2-preferences-button-duplicate::before {
    content: "⚙ "; /* Adds a settings icon before the text */
    font-size: 1em; /* Match text size */
    margin-right: 5px; /* Space between icon and text */
}


/* Media Query for screens wider than 640px (Desktop) */
@media (min-width: 640px) {
    #cookie-consent-v2-preferences-button-duplicate {right:1em !important;}
}



/* Simplified styles for the cookie consent modal */

/* Background */
#cookie-consent-v2-preferences-modal {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: white;
    padding: 20px;
    border-top: 1px solid #ccc;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10000;
}

/* Ensure the modal is always positioned relative to the viewport */
html, body {
    height: 100%;
    margin: 0;
    overflow-x: hidden;
}

/* Modal content */
#cookie-consent-v2-preferences-modal .modal-content {
    max-height: 70vh;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Close button */
#cookie-consent-v2-preferences-modal .close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
}

/* 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: 10px;
    display: block;
    width: auto;
}

/* Show when modal is open */
#cookie-consent-v2-preferences-modal.show {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
}

/* Desktop adjustments */
@media (min-width: 640px) {
    #cookie-consent-v2-preferences-modal {
        position: fixed;
        width: 480px;
        right: 20px;
        bottom: 60px;
        left: auto;
        height:30vh;
    }
}
