/* Google Consent Mode v2 - Styles */

/* Overlay */
.gcm-consent-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    animation: fadeIn 0.3s ease-in-out;
}

/* Banner główny */
.gcm-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    background: #ffffff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    z-index: 999999;
    animation: slideUp 0.3s ease-in-out;
    /* Przy powiększonym tekście baner nie wychodzi poza ekran – przewija się w środku */
    box-sizing: border-box;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.gcm-consent-banner.gcm-position-bottom {
    bottom: 0;
}

.gcm-consent-banner.gcm-position-top {
    top: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gcm-consent-banner.gcm-position-center {
    top: 50%;
    left: 50%;
    right: auto;
    width: calc(100% - 2rem);
    transform: translate(-50%, -50%);
    max-width: 600px;
    border-radius: 10px;
}

.gcm-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.gcm-banner-text {
    flex: 1;
    min-width: 300px;
    min-width: min(300px, 100%);
}

.gcm-banner-text p {
    margin: 0 0 5px 0;
    color: #333333;
    font-size: 0.875rem;
    line-height: 1.5;
}

.gcm-banner-text p:last-child {
    margin-bottom: 0;
}

.gcm-banner-text h3 {
    margin: 0 0 8px 0;
    font-size: 1.125rem;
    line-height: 1.3;
}

.gcm-banner-text h4 {
    margin: 0 0 6px 0;
    font-size: 1rem;
    line-height: 1.3;
}

.gcm-banner-text a {
    text-decoration: underline;
    font-weight: 500;
}

.gcm-banner-text a:hover {
    opacity: 0.8;
}

.gcm-banner-text ul,
.gcm-banner-text ol {
    margin: 5px 0;
    padding-left: 20px;
}

.gcm-banner-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Przyciski */
.gcm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    /* Bez „all” – obrys fokusu pojawia się od razu */
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}

.gcm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Kolory przy najechaniu dla kolorów domyślnych; przy kolorach z ustawień wylicza je wtyczka we wbudowanym <style> */
.gcm-btn-accept {
    background-color: #4CAF50;
    color: white;
}

.gcm-btn-accept:hover {
    background-color: #45a049;
}

.gcm-btn-reject {
    background-color: #f44336;
    color: white;
}

.gcm-btn-reject:hover {
    background-color: #da190b;
}

.gcm-btn-settings {
    background-color: #2196F3;
    color: white;
}

.gcm-btn-settings:hover {
    background-color: #0976d2;
}

/* Fokus z klawiatury. Kolor obrysu nadpisuje wbudowany <style> kolorem tekstu banera lub okna */
.gcm-consent-banner :focus-visible,
.gcm-modal :focus-visible,
.gcm-switch input:focus-visible + .gcm-slider {
    outline: 3px solid #1a1a1a;
    outline-offset: 2px;
}

/* Samo okno dostaje fokus programowo po otwarciu (czytnik ekranu odczytuje tytuł i opis) – bez obrysu wokół całego okna */
.gcm-modal .gcm-modal-content:focus {
    outline: none;
}

/* Tekst tylko dla czytników ekranu */
.gcm-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Modal ustawień */
.gcm-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.gcm-modal-content {
    background-color: #fefefe;
    margin: 50px auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 10px;
    animation: slideDown 0.3s;
}

.gcm-modal-header {
    padding: 20px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gcm-modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
}

/* „×” to teraz <button> – bez wyglądu przycisku przeglądarki, pole kliknięcia 44×44 px.
   Selektor z #id wygrywa z globalnymi stylami przycisków motywu (np. „[type=button]” w resecie Hello Elementor,
   „.elementor-kit-N button” z ustawień Elementora); reguły #gcm… w CSS motywu ładowanym po wtyczce nadal wygrywają z tymi. */
#gcm-settings-modal .gcm-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: auto;
    height: auto;
    min-width: 2.75rem;
    min-height: 2.75rem;
    margin: 0 0 0 10px;
    padding: 0 0.25rem;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    font-family: inherit;
    color: #666;
    font-size: 1.75rem;
    font-weight: bold;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    transition: color 0.2s ease;
}

#gcm-settings-modal .gcm-close:hover,
#gcm-settings-modal .gcm-close:focus {
    background: none;
    color: #000;
}

.gcm-modal-body {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.gcm-modal-body p {
    color: #666;
    margin-bottom: 20px;
}

.gcm-modal-footer {
    padding: 20px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-radius: 0 0 10px 10px;
}

.gcm-modal-footer a {
    color: #1565c0;
    text-decoration: none;
}

.gcm-modal-footer a:hover {
    text-decoration: underline;
}

/* Kategorie zgód */
.gcm-consent-category {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.gcm-consent-category:hover {
    background-color: #f0f0f0;
}

.gcm-category-info {
    flex: 1;
    margin-left: 15px;
}

.gcm-category-info h3 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1rem;
}

.gcm-category-info p {
    margin: 0;
    color: #666;
    font-size: 0.875rem;
}

/* Switch/Toggle */
.gcm-switch {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 50px;
    height: 24px;
}

.gcm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gcm-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Tor wyłączonego przełącznika i biała gałka – kontrast min. 3:1 do tła kategorii */
    background-color: #8c8c8c;
    transition: background-color .4s;
    border-radius: 24px;
}

.gcm-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: transform .4s;
    border-radius: 50%;
}

input:checked + .gcm-slider {
    background-color: #4CAF50;
}

input:disabled + .gcm-slider {
    background-color: #4CAF50;
    opacity: 0.6;
    cursor: not-allowed;
}

input:checked + .gcm-slider:before {
    transform: translateX(26px);
}

/* Animacje */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsywność */
@media (max-width: 768px) {
    .gcm-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .gcm-banner-buttons {
        width: 100%;
        justify-content: center;
    }

    .gcm-btn {
        padding: 8px 16px;
        font-size: 0.8125rem;
        /* Przy powiększonym tekście napis zawija się zamiast poszerzać przycisk poza ekran */
        white-space: normal;
    }

    .gcm-modal-content {
        width: 95%;
        margin: 20px auto;
    }

    .gcm-consent-category {
        flex-direction: column;
        text-align: center;
    }

    .gcm-category-info {
        margin-left: 0;
        margin-top: 10px;
    }
}

/* Floating settings button (opcjonalne) */
.gcm-floating-settings {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background-color: #2196F3;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gcm-floating-settings:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.gcm-floating-settings svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* Floating Cookie Button – <button>, więc bez obramowania i czcionki przeglądarki */
.gcm-floating-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    margin: 0;
    border: 0;
    font-family: inherit;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;

    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50px;
    padding: 9px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 99998;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInLeft 0.5s ease-out;
}

.gcm-floating-button:hover {
    transform: translateX(5px) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.gcm-floating-button:active {
    transform: scale(0.95);
}

/* Fokus z klawiatury: ciemny obrys z białą obwódką – widoczny na jasnym i ciemnym tle strony */
.gcm-floating-button:focus-visible {
    outline: 3px solid #1a1a1a;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px #fff;
}

.gcm-floating-button svg {
    width: 24px;
    height: 24px;
    color: white;
    flex-shrink: 0;
}

/* Tekst schowany (szerokość 0), wysuwa się przy najechaniu i przy fokusie z klawiatury.
   Nazwę dostępną przycisk ma z aria-label (tooltip z ustawień). */
.gcm-floating-text {
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    margin-left: 0;
    white-space: nowrap;
    max-width: 0;
    overflow: hidden;
    transition: max-width 0.3s ease-in-out, margin 0.3s ease-in-out;
}

/* :hover i :focus-visible w osobnych regułach – przeglądarka bez :focus-visible odrzuciłaby całą regułę */
.gcm-floating-button:hover .gcm-floating-text {
    max-width: 15em;
    margin-left: 10px;
}

.gcm-floating-button:focus-visible .gcm-floating-text {
    max-width: 15em;
    margin-left: 10px;
}

/* Animacja wejścia floating button */
@keyframes slideInLeft {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Pulsowanie floating button co jakiś czas */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(102, 126, 234, 0.8);
    }
    100% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
}

.gcm-floating-button.pulse {
    animation: pulse 2s infinite;
}

/* Alternatywne style floating button */
.gcm-floating-button.style-minimal {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid #e0e0e0;
}

.gcm-floating-button.style-minimal svg {
    color: #333;
}

.gcm-floating-button.style-minimal .gcm-floating-text {
    color: #333;
}

.gcm-floating-button.style-minimal:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #2196F3;
}

/* Pływający przycisk to teraz <button> – selektor z #id wygrywa z globalnymi stylami przycisków motywu (jak przy „×”).
   Tylko właściwości, które takie style zmieniają; położenie (bottom, left) zostaje w regule .gcm-floating-button. */
#gcm-floating-button {
    min-width: 0;
    min-height: 0;
    width: auto;
    height: auto;
    margin: 0;
    padding: 9px;
    border: 0;
    border-radius: 50px;
    font-size: inherit;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#gcm-floating-button.style-minimal,
#gcm-floating-button.style-minimal:focus {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e0e0e0;
}

#gcm-floating-button.style-minimal:hover {
    background: rgba(255, 255, 255, 1);
    border-color: #2196F3;
}

/* Style dla małych ekranów */
@media (max-width: 480px) {
    .gcm-floating-button {
        bottom: 15px;
        left: 15px;
    }

    #gcm-floating-button {
        padding: 10px;
    }

    .gcm-floating-button svg {
        width: 20px;
        height: 20px;
    }

    .gcm-floating-button .gcm-floating-text {
        display: none;
    }
}

/* Niski ekran (np. powiększenie 400%): przewija się tylko okno, bez drugiego paska w treści */
@media (max-height: 600px) {
    .gcm-modal-body {
        max-height: none;
        overflow-y: visible;
    }
}

/* Tryb wymuszonych kolorów (Windows – kontrast wysoki): tor i gałka przełącznika dostają kolory systemowe,
   inaczej oba przyjmują ten sam kolor i stanu przełącznika nie widać. Selektory z #gcm-settings-modal – mocniejsze niż wbudowany <style>. */
@media (forced-colors: active) {
    #gcm-settings-modal .gcm-switch .gcm-slider {
        box-sizing: border-box;
        border: 2px solid CanvasText;
    }

    #gcm-settings-modal .gcm-switch .gcm-slider:before {
        forced-color-adjust: none;
        left: 1px;
        bottom: 1px;
        background-color: CanvasText;
    }

    #gcm-settings-modal .gcm-switch input:checked + .gcm-slider {
        forced-color-adjust: none;
        background-color: Highlight;
        border-color: Highlight;
    }

    #gcm-settings-modal .gcm-switch input:checked + .gcm-slider:before {
        background-color: HighlightText;
    }

    #gcm-settings-modal .gcm-switch input:disabled + .gcm-slider {
        forced-color-adjust: none;
        background-color: GrayText;
        border-color: GrayText;
        opacity: 1;
    }

    #gcm-settings-modal .gcm-switch input:disabled + .gcm-slider:before {
        background-color: Canvas;
    }

    /* Przyciski bez ramki wyglądałyby jak zwykły tekst – ramka w kolorze systemowym */
    .gcm-btn,
    #gcm-settings-modal .gcm-close,
    #gcm-floating-button,
    #gcm-floating-button.style-minimal {
        border: 2px solid ButtonText;
    }
}

/* Ograniczony ruch – bez animacji wjazdu i przejść */
@media (prefers-reduced-motion: reduce) {
    .gcm-consent-overlay,
    .gcm-consent-banner,
    .gcm-modal,
    .gcm-modal-content,
    .gcm-floating-button {
        animation: none;
    }

    .gcm-btn,
    .gcm-slider,
    .gcm-slider:before,
    .gcm-floating-text,
    .gcm-consent-category,
    #gcm-settings-modal .gcm-close,
    #gcm-floating-button {
        transition: none;
    }
}

