/* ==================================================
   ΚΟΙΝΟ POP-UP ΠΟΛΙΤΙΚΩΝ
   ================================================== */

.policy-popup {
    --popup-background: #ffffff;
    --popup-text: #334155;
    --popup-title: #17324d;
    --popup-accent: #2563eb;
    --popup-border: #e2e8f0;

    box-sizing: border-box;
    width: min(920px, calc(100% - 32px));

    /* Εναλλακτική τιμή για browsers χωρίς υποστήριξη dvh */
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);

    margin: auto;
    padding: 0;

    color: var(--popup-text);
    background: var(--popup-background);
    border: 1px solid var(--popup-border);
    border-radius: 24px;
    box-shadow: 0 24px 80px rgb(15 23 42 / 24%);

    font-family: inherit;

    /* Η κύλιση γίνεται στην εσωτερική περιοχή */
    overflow: hidden;
    overscroll-behavior: contain;
}

/* Διατήρηση του παραθύρου κρυφού πριν ανοίξει */
.policy-popup:not([open]) {
    display: none;
}

/* Ενιαία συμπεριφορά διαστάσεων */
.policy-popup *,
.policy-popup *::before,
.policy-popup *::after {
    box-sizing: border-box;
}

/* Σκοτεινό φόντο πίσω από το παράθυρο */
.policy-popup::backdrop {
    background-color: rgb(15 23 42 / 58%);
    backdrop-filter: blur(5px);
}

/* ==================================================
   ΕΣΩΤΕΡΙΚΟ ΠΛΑΙΣΙΟ
   ================================================== */

.policy-popup__container {
    position: relative;
    isolation: isolate;
    min-width: 0;
}

/* Περιοχή κύλισης φωτογραφίας και κειμένου */
.policy-popup__scroll-area {
    max-height: calc(100vh - 34px);
    max-height: calc(100dvh - 34px);

    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;

    /* Χώρος για το κουμπί κλεισίματος */
    padding-top: 68px;
    scroll-padding-block: 24px;
}

/* ==================================================
   ΚΟΥΜΠΙ ΚΛΕΙΣΙΜΑΤΟΣ
   ================================================== */

.policy-popup__close-form {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    margin: 0;
    padding: 0;
}

.policy-popup__close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;
    padding: 0;

    color: var(--popup-title);
    background-color: #f1f5f9;
    border: 1px solid var(--popup-border);
    border-radius: 50%;

    font-family: inherit;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;

    transition:
        color 160ms ease,
        background-color 160ms ease,
        border-color 160ms ease;
}

@media (hover: hover) {
    .policy-popup__close-button:hover {
        color: var(--popup-accent);
        background-color: #eaf2ff;
        border-color: #bfdbfe;
    }
}

.policy-popup__close-button:focus-visible {
    outline: 3px solid var(--popup-accent);
    outline-offset: 3px;
}

/* Κείμενο διαθέσιμο στους αναγνώστες οθόνης */
.policy-popup__visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ==================================================
   ΦΩΤΟΓΡΑΦΙΑ
   ================================================== */

.policy-popup__image-container {
    margin: 0 20px;
    overflow: hidden;
    background-color: #f1f5f9;
    border-radius: 16px;
}

/* Το hidden υπερισχύει ακόμη και άλλων κανόνων εμφάνισης */
.policy-popup [hidden] {
    display: none !important;
}

.policy-popup__image {
    display: block;
    width: 100%;
    height: auto;

    /* Η φωτογραφία εμφανίζεται ολόκληρη, χωρίς περικοπή */
    max-height: 360px;
    object-fit: contain;
    object-position: center;
}

/* ==================================================
   ΤΙΤΛΟΣ ΚΑΙ ΠΛΗΡΕΣ ΚΕΙΜΕΝΟ
   ================================================== */

.policy-popup__text {
    padding: 28px 24px 36px;
}

.policy-popup__heading {
    margin: 0 0 24px;
    padding: 0 0 20px;
    border-bottom: 1px solid var(--popup-border);
}

.policy-popup__title {
    margin: 0;
    color: var(--popup-title);

    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;

    overflow-wrap: anywhere;
}

.policy-popup__content {
    max-width: 72ch;
    margin-inline: auto;

    color: var(--popup-text);
    font-size: 1rem;
    line-height: 1.85;

    /* Διατήρηση παραγράφων και αλλαγών γραμμής από το Admin */
    white-space: normal;

    /* Αποφυγή οριζόντιας κύλισης από μεγάλα URLs */
    overflow-wrap: anywhere;
}

/* ==================================================
   ΜΕΓΑΛΥΤΕΡΕΣ ΟΘΟΝΕΣ
   ================================================== */

@media (min-width: 768px) {
    .policy-popup__image-container {
        margin-inline: 40px;
    }

    .policy-popup__text {
        padding: 32px 48px 48px;
    }

    .policy-popup__heading {
        margin-bottom: 28px;
        padding-bottom: 24px;
    }

    .policy-popup__content {
        font-size: 1.0625rem;
    }
}

/* ==================================================
   ΜΙΚΡΑ ΚΙΝΗΤΑ ΣΕ ΚΑΤΑΚΟΡΥΦΗ ΘΕΣΗ
   ================================================== */

@media (max-width: 479px) and (orientation: portrait) {
    .policy-popup {
        width: calc(100% - 16px);

        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);

        border-radius: 18px;
    }

    .policy-popup__scroll-area {
        max-height: calc(100vh - 18px);
        max-height: calc(100dvh - 18px);
    }

    .policy-popup__image-container {
        margin-inline: 16px;
        border-radius: 12px;
    }

    .policy-popup__text {
        padding: 24px 20px 32px;
    }

    .policy-popup__content {
        line-height: 1.75;
    }
}

/* Χαμηλές οθόνες, όπως κινητά σε οριζόντια θέση */
@media (max-height: 500px) {
    .policy-popup__image {
        max-height: 180px;
    }
}

/* ==================================================
   ΚΙΝΗΣΗ ΑΝΟΙΓΜΑΤΟΣ
   ================================================== */

@keyframes policy-popup-appear {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .policy-popup[open] {
        animation: policy-popup-appear 180ms ease-out;
    }
}

/* ==================================================
   ΚΛΕΙΔΩΜΑ ΚΥΛΙΣΗΣ ΤΗΣ ΣΕΛΙΔΑΣ

   Το JavaScript θα προσθέτει αυτή την κλάση
   στο html όσο το pop-up παραμένει ανοιχτό.
   ================================================== */

html.policy-popup-is-open,
html.policy-popup-is-open body {
    overflow: hidden;
}