/* ===== Gritter – modern glassy frissítés (CSS-only) ===== */

:root {
    --gritter-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --gritter-bg: rgba(20, 20, 20, 0.72);        /* üveges sötét háttér */
    --gritter-fg: #fff;                          /* szövegszín */
    --gritter-border: rgba(255,255,255,.10);
    --gritter-radius: 16px;
    --gritter-shadow: 0 14px 40px rgba(0,0,0,.25);
    --gritter-padding: 16px 18px;
    --gritter-gap: 14px;
    --gritter-life: 6000ms;                      /* (opcionális) progress anim hossza */
    --gritter-accent: #60a5fa;                   /* .gritter-primary esetén */
}

/* Világos téma: add <body class="gritter-light"> */
.gritter-light {
    --gritter-bg: rgba(255,255,255,.85);
    --gritter-fg: #0b0b0b;
    --gritter-border: rgba(0,0,0,.08);
    --gritter-shadow: 0 14px 40px rgba(0,0,0,.18);
    --gritter-accent: #2563eb;
}

/* Wrapper helyzete (jobb felső sarok alapértelmezett) */
#gritter-notice-wrapper {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: grid;
    gap: var(--gritter-gap);
    pointer-events: none; /* csak a kártyák kattinthatók */
    font-family: var(--gritter-font);
}

/* Régi felső/alsó díszcsíkok elrejtése */
#gritter-notice-wrapper .gritter-top,
#gritter-notice-wrapper .gritter-bottom {
    display: none !important;
}

/* Kártya */
#gritter-notice-wrapper .gritter-item {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 14px;

    color: var(--gritter-fg);
    background: var(--gritter-bg);
    border: 1px solid var(--gritter-border);
    border-radius: var(--gritter-radius);
    box-shadow: var(--gritter-shadow);
    padding: var(--gritter-padding);
    pointer-events: auto; /* kattinthatóvá vissza */
    overflow: hidden;

    /* belépő animáció */
    opacity: 0;
    transform: translateY(8px) scale(.98);
    animation: gr-enter .35s cubic-bezier(.2,.8,.2,1) forwards;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@keyframes gr-enter {
    to { opacity: 1; transform: none; }
}

/* Hover emelés */
#gritter-notice-wrapper .gritter-item-wrapper:hover .gritter-item {
    transform: translateY(-1px);
    box-shadow: 0 18px 50px rgba(0,0,0,.30);
    transition: transform .18s ease, box-shadow .18s ease;
}

/* Kép */
#gritter-notice-wrapper .gritter-image {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: inset 0 0 0 1px var(--gritter-border);
}

/* Szövegblokk (a meglévő .gritter-with-image/.gritter-without-image marad) */
#gritter-notice-wrapper .gritter-with-image,
#gritter-notice-wrapper .gritter-without-image {
    margin: 0; padding: 0;
}

/* Cím és szöveg */
#gritter-notice-wrapper .gritter-title {
    display: block;
    font-weight: 700;
    font-size: 15.5px;
    margin-bottom: 4px;
}
#gritter-notice-wrapper p {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    opacity: .95;
}

/* Close gomb – a meglévő <a> elem újrastylingolva */
#gritter-notice-wrapper .gritter-close {
    position: absolute;
    top: 8px; right: 8px;
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: 10px;
    text-indent: 0;
    font-size: 20px;
    line-height: 1;
    color: inherit;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: .75;

    /* linkből gomb – töröljük az alap linkstílust */
    text-decoration: none;
    outline: none;
}
#gritter-notice-wrapper .gritter-close::before {
    content: "×"; /* ikon helyett X */
    transform: translateY(-1px);
}
#gritter-notice-wrapper .gritter-close:hover {
    opacity: 1;
    background: rgba(255,255,255,.10);
}
#gritter-notice-wrapper .gritter-close:focus-visible {
    box-shadow: 0 0 0 2px var(--gritter-fg);
}

/* “Progress bar” – CSS-only, pszeudo-elemmel (időt a --gritter-life szabja) */
#gritter-notice-wrapper .gritter-item::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(255,255,255,.55), rgba(255,255,255,.85));
    transform-origin: left;
    animation: gr-life var(--gritter-life) linear forwards;
    opacity: .9;
}
@keyframes gr-life {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* Variáns – az általad használt .gritter-primary osztály */
#gritter-notice-wrapper .gritter-item-wrapper.gritter-primary .gritter-item::after {
    background: linear-gradient(90deg, var(--gritter-accent), rgba(255,255,255,.9));
}

/* Jobb olvashatóság kis kijelzőn */
@media (max-width: 480px) {
    #gritter-notice-wrapper {
        left: 10px; right: 10px; top: 10px;
    }
    #gritter-notice-wrapper .gritter-item {
        grid-template-columns: 1fr; /* kép felül, szöveg alatta */
        text-align: left;
    }
    #gritter-notice-wrapper .gritter-image {
        width: 42px; height: 42px;
    }
}

/* Mozgáscsökkentés a rendszerbeállítás szerint */
@media (prefers-reduced-motion: reduce) {
    #gritter-notice-wrapper .gritter-item,
    #gritter-notice-wrapper .gritter-item::after {
        animation: none !important;
        transform: none !important;
    }
}

/* ===== Gritter status színek – szemkímélő tónusok ===== */

/* success: nyugodt, pasztelles kékeszöld */
#gritter-notice-wrapper .gritter-item-wrapper.gritter-success .gritter-item {
    background: linear-gradient(145deg, #e0f2ff, #d5f4ee);
    color: #023047;
    border: 1px solid #b3e2dd;
    box-shadow: 0 6px 22px rgba(2, 48, 71, 0.15);
}
#gritter-notice-wrapper .gritter-item-wrapper.gritter-success .gritter-item::after {
    background: #ae8313;
}

/* error: szemkímélő korall / lazac */
#gritter-notice-wrapper .gritter-item-wrapper.gritter-error .gritter-item {
    background: linear-gradient(145deg, #ffe5e5, #ffecec);
    color: #4b0b0b;
    border: 1px solid #ffc7c7;
    box-shadow: 0 6px 22px rgba(75, 11, 11, 0.15);
}
#gritter-notice-wrapper .gritter-item-wrapper.gritter-error .gritter-item::after {
    background: linear-gradient(90deg, #fb7185, #f43f5e);
}

/* info / primary: visszafogott acélkék */
#gritter-notice-wrapper .gritter-item-wrapper.gritter-primary .gritter-item {
    background: linear-gradient(145deg, #EAE4D9, #EAE4D9);
    color: #0f172a;
    border: 1px solid #ae8313;
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.15);
}
#gritter-notice-wrapper .gritter-item-wrapper.gritter-primary .gritter-item::after {
    background: #ae8313;
}

/* közös finomítás – minden variáns */
#gritter-notice-wrapper .gritter-item {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform .18s ease, box-shadow .18s ease;
}
#gritter-notice-wrapper .gritter-item-wrapper:hover .gritter-item {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

/* ===== Finomhangolás: régi perem és close gomb javítása ===== */

/* távolítsuk el a régi top/bottom háttéreket teljesen */
#gritter-notice-wrapper .gritter-top,
#gritter-notice-wrapper .gritter-bottom {
    display: none !important;
    background: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* biztos ami biztos – a wrapper se örököljön régiféle háttért */
#gritter-notice-wrapper .gritter-item-wrapper {
    background: none !important;
}

/* close gomb igazítása */
#gritter-notice-wrapper .gritter-close {
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    opacity: 0.75;
    background: transparent;
    border: none;
    color: inherit;
    display: grid;
    place-items: center;
    border-radius: 6px;
    text-decoration: none;
}

#gritter-notice-wrapper .gritter-close::before {
    content: "×";
    font-weight: 600;
}

#gritter-notice-wrapper .gritter-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
}

/* ha világos témát használsz, akkor világosabb hover */
.gritter-light .gritter-close:hover {
    background: rgba(0, 0, 0, 0.06);
}


/* ===== Close gomb – kompakt, kerek ikon; a kártya jobb oldala kitámasztva ===== */

/* adunk helyet a jobb oldali, kör alakú close gombnak */
#gritter-notice-wrapper .gritter-item {
    padding-right: 56px; /* ne lógjon rá a szövegre */
}

/* Örökölt ::before-t kikapcsoljuk, hogy ne duplázzon ikont */
#gritter-notice-wrapper .gritter-close::before { content: none !important; }

/* A linkből igazi, kerek ikon gomb – a link szövegét elrejtjük */
#gritter-notice-wrapper .gritter-close {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);        /* függőlegesen középen */
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    display: grid;
    place-items: center;
    font-size: 0;                        /* a "Close Notification" szöveget elnémítjuk */
    line-height: 1;
    text-indent: 0;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,.45);
    background: rgba(255,255,255,.32);   /* üveges alap */
    color: #ae8313;                         /* X ikon színe */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    cursor: pointer;
    outline: none;
    opacity: 1;                          /* teljesen látszódjon */
}

/* Az X ikon – mostantól itt jön */
#gritter-notice-wrapper .gritter-close::after {
    content: "✕";
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

/* Hover/active állapot */
#gritter-notice-wrapper .gritter-close:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,.22);
}
#gritter-notice-wrapper .gritter-close:active {
    transform: translateY(-50%) scale(.96);
}

/* Tónusok variánsonként – finom, szemkímélő */
#gritter-notice-wrapper .gritter-item-wrapper.gritter-primary .gritter-close {
    background: rgba(59,130,246,.28);    /* kékség az info/primary-hoz */
    border-color: rgba(255,255,255,.55);
    color: #ae8313;
}
#gritter-notice-wrapper .gritter-item-wrapper.gritter-success .gritter-close {
    background: rgba(14,165,233,.26);    /* kékeszöldes árnyalat */
    border-color: rgba(255,255,255,.55);
    color: #003b4a;
}
#gritter-notice-wrapper .gritter-item-wrapper.gritter-error .gritter-close {
    background: rgba(244,63,94,.28);     /* lágy korall-piros */
    border-color: rgba(255,255,255,.55);
    color: #4b0b0b;
}

/* fókusz (billentyűzet): finom gyűrű */
#gritter-notice-wrapper .gritter-close:focus-visible {
    box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 2px 6px rgba(0,0,0,.2);
}

/* ===== Gritter kilógás javítás – teljesen belülre hozza ===== */

/* a wrappert beljebb hozzuk, ne a képernyő peremére üljön */
#gritter-notice-wrapper {
    position: fixed;
    top: 20px;
    right: 20px;             /* biztonságos távolság */
    z-index: 9999;
    max-width: min(360px, calc(100vw - 40px)); /* soha ne lógjon ki */
    overflow: visible;       /* az árnyék ne vágódjon le */
    box-sizing: border-box;
}

/* a kártya belső margóit korrigáljuk, hogy ne tolja ki a close gombot */
#gritter-notice-wrapper .gritter-item {
    padding-right: 40px;     /* 56px helyett – pont elfér a gomb */
    max-width: 100%;         /* igazodjon a wrapper max-width-hoz */
    box-sizing: border-box;
}

/* a close gomb elhelyezését finoman beljebb hozzuk */
#gritter-notice-wrapper .gritter-close {
    right: 10px !important;  /* kicsit beljebb húzzuk */
    transform: translateY(-50%);
}

/* a box-shadow ne tolja ki a layoutot */
#gritter-notice-wrapper .gritter-item {
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}

/* extra védelem kis képernyőn */
@media (max-width: 480px) {
    #gritter-notice-wrapper {
        left: 10px;
        right: 10px;
        max-width: 100%;
    }
    #gritter-notice-wrapper .gritter-item {
        padding-right: 36px;
    }
}

/* ===== Gritter – pozicionálás: jobb felső, de kissé beljebb ===== */
#gritter-notice-wrapper {
    position: fixed;
    top: 20px;
    right: 12.5%;
    transform: translateX(180px);
    z-index: 9999;
    max-width: 360px;
    width: 360px;
    pointer-events: none;
    display: grid;
    gap: 14px;
}

@media (min-width: 1920px) {
    #gritter-notice-wrapper {
        right: 10%;
    }
}

/* a toast maga továbbra is interaktív */
#gritter-notice-wrapper .gritter-item {
    pointer-events: auto;
}

/* kisebb kijelzőn automatikusan visszacsúszik a jobb szélére */
@media (max-width: 1024px) {
    #gritter-notice-wrapper {
        right: 20px;
        transform: none;
    }
}

/* ===== Gritter – close text teljes elrejtés + teljes lekerekítés fix ===== */

/* teljes lekerekítés mindkét wrapperre */
#gritter-notice-wrapper .gritter-item-wrapper,
#gritter-notice-wrapper .gritter-item {
    border-radius: 18px !important;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(0,0,0,0.05);
}

/* biztos ami biztos: a régi Close Notification szöveget rejtsük el */
#gritter-notice-wrapper .gritter-close {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0 !important;      /* a szöveg teljes elnémítása */
    color: transparent !important;/* ha maradna bármi text */
    overflow: hidden;
    text-indent: -9999px;         /* végső biztosítás */
    background: rgba(255,255,255,0.25);
    border: 1px solid rgba(255,255,255,0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: pointer;
    opacity: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* saját X ikon */
#gritter-notice-wrapper .gritter-close::after {
    content: "✕";
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #ae8313;
    text-indent: 0;
    transform: translateY(-0.5px);
}

/* hover – világosabb, enyhe mozgás */
#gritter-notice-wrapper .gritter-close:hover {
    background: rgba(255,255,255,0.35);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

/* állapotokhoz illesztett árnyalatok */
#gritter-notice-wrapper .gritter-item-wrapper.gritter-error .gritter-close {
    background: rgba(244,63,94,0.25);
    border-color: rgba(244,63,94,0.45);
    color: #7f1d1d;
}
#gritter-notice-wrapper .gritter-item-wrapper.gritter-primary .gritter-close {
    background: #EAE4D9;
    border-color: #EAE4D9;
    color: #1e3a8a;
}
#gritter-notice-wrapper .gritter-item-wrapper.gritter-success .gritter-close {
    background: rgba(45,212,191,0.25);
    border-color: rgba(45,212,191,0.45);
    color: #064e3b;
}
