/**
 * Plugin Name: Cookie Craft
 * Description: GDPR compliant cookie consent banner with Google Consent Mode v2 integration.
 * Version: 2.0
 * Author: Bogdan Paunica
 */

/* IMPORTANT:
   Nu aplica reguli globale (html/body/*/.clear) - pot rupe teme complexe (Elementor, sticky, animations).
   Scope strict doar pe elementele pluginului.
*/

#cookie-consent-v2-banner,
#cookie-consent-v2-banner *,
#cookie-consent-v2-preferences-modal,
#cookie-consent-v2-preferences-modal *,
#cookie-consent-v2-preferences-button-duplicate,
#cookie-consent-v2-preferences-button-duplicate * {
    box-sizing: border-box;
}

/* Basic styling for the cookie consent banner */
#cookie-consent-v2-banner {
	position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 480px;
    background-color: var(--cc-bg, #f0f0f0);
    padding: 20px;
    z-index: 9999;
    box-shadow: 0px -2px 5px rgba(0, 0, 0, 0.2);
    max-height: 80vh;

    display: flex;
    flex-direction: column;

    /* Text color implicit pentru banner (fara sa afecteze restul site-ului) */
    color: var(--cc-text, #111111);
}

/* Desktop adjustments */
@media (min-width: 640px) {
    #cookie-consent-v2-banner {
        width: 480px;
        right: 20px;
        bottom: 20px;
        left: auto;
    }
}

/* Title */
#cookie-consent-v2-banner-title {
    background-color: var(--cc-accent, #007bff);
    color: var(--cc-accent-text, #ffffff);
    text-align: center;
    padding: 1em;
    font-weight: bold;
    height: 50px;
}

/* Asigura explicit ca textul din header ramane alb (nu este suprascris de reguli de text) */
#cookie-consent-v2-banner-title p,
#cookie-consent-v2-banner-title .cookie-banner-title {
    color: var(--cc-accent-text, #ffffff);
    margin: 0;
    font-size: 1.2em;
}

/* Scrollable text */
#cookie-consent-v2-banner-text {
    overflow-y: auto;
    padding: 10px;
    flex-grow: 1;
    min-height: 50px;
}

/* Text in banner */
#cookie-consent-v2-banner p {
    margin-bottom: 10px;
    text-align: center;
    font-size: 1em;
}

/* Lists inside banner */
#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;
}

/* Links section - scoped */
#cookie-consent-v2-banner .cookie-consent-v2-links {
    text-align: center;
    margin: 10px 0;
}

#cookie-consent-v2-banner .cookie-consent-v2-links .link-button {
    display: inline-block;
    padding: 8px 12px;
    color: var(--cc-accent, #007bff);
    text-decoration: none;
    font-size: 0.9em;
    border: 1px solid var(--cc-accent, #007bff);
    background: none;
    cursor: pointer;
    margin: 5px;
}

#cookie-consent-v2-banner .cookie-consent-v2-links .link-button:hover {
    background-color: var(--cc-accent, #007bff);
    color: var(--cc-accent-text, #ffffff);
}

/* Buttons section */
#cookie-consent-v2-banner .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: var(--cc-accent, #007bff);
    color: var(--cc-accent-text, #ffffff);
    cursor: pointer;
    font-size: 1em;
}

#cookie-consent-v2-reject-button:hover,
#cookie-consent-v2-accept-button:hover {
    background-color: var(--cc-accent, #007bff);
}

/* Preferences button (Change preferences) - foloseste Accent color si este sigur vizibil */
#cookie-consent-v2-preferences-button-duplicate {
    padding: 0 1.5em;
    height: 3em;

    background-color: var(--cc-accent, #007bff);
	opacity:0.5;
    color: var(--cc-accent-text, #ffffff);

    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    position: fixed;
    bottom: calc(1em + 8px);
    right: calc(1em + 8px);
    left: auto;

    z-index: 9997;

    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 {
    opacity:1;
}

#cookie-consent-v2-preferences-button-duplicate::before {
    content: "⚙ ";
    font-size: 1em;
    margin-right: 5px;
}

/* Simplified styles for the cookie consent modal */
#cookie-consent-v2-preferences-modal {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;

    background-color: #ffffff;
    color: var(--cc-text, #111111);

    padding: 20px;
    border-top: 1px solid #ccc;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);

    z-index: 9998;
}

#cookie-consent-v2-preferences-modal .modal-content {
    max-height: 70vh;
    overflow-y: auto;
    padding-bottom: 20px;
}

#cookie-consent-v2-preferences-modal .close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
}

/* Save Preferences button - foloseste Accent color */
#cookie-consent-v2-preferences-modal #cookie-consent-v2-save-preferences {
    padding: 10px 20px;
    background-color: var(--cc-accent, #007bff);
    border: none;
    color: var(--cc-accent-text, #ffffff);
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    display: block;
    width: auto;
}

#cookie-consent-v2-preferences-modal.show {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
}

/* Desktop modal adjustments */
@media (min-width: 640px) {
    #cookie-consent-v2-preferences-modal {
        width: 480px;
        right: 20px;
        bottom: 12px;
        left: auto;
        max-height: 60vh;
		height: auto;
    }
}
