/* ==========================================================
   ROOT VARIABLES (colors, dimensions)
   ========================================================== */
   :root {
    --blue: #4691BF;
    --light-blue: #8CBBD7;
    --purple: #895B8B;
    --light-purple: #B699B7;
    --text: #333;
    --items: white;
    --author: gray;
    --counter:gray;
    --button-segment: #ededed;
    --button-all: #b2b2b2;
    --button-filter: white;
    --body: #fff;
    --item-min-width: 10rem;
    --item-min-height: 15.5rem;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --blue: #79D4FF;
        --light-blue: #B9E7F5;
        --purple: #D8A3D8;
        --light-purple: #EAC6EA;
        --body: #222222;
        --button-segment: #222222;
        --button-filter: #333333;
        --items: #333333;
        --text: white;
        --author: #ededed;
        --counter: #ededed;
    }
}

/* ==========================================================
   FONT IMPORT
   ========================================================== */
@font-face {
    font-family: 'ND_R';
    src: url('assets/ND_R.TTF') format('truetype');
}

/* ==========================================================
   GLOBAL STYLES
   ========================================================== */
body, html {
    margin: 0;
    padding: 0;
    font-family: 'ND_R', Arial, sans-serif;
    background-color: var(--body);
    color: #333;
}

/* ==========================================================
   BUTTON STYLES
   ========================================================== */
.button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 2.7rem;
    width: fit-content;
    background-color: var(--button-segment);
    border-radius: 0.2rem;
    padding: 0.3rem;
    margin: 0.5rem auto;
}

.filter-segment {
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
    color: var(--text);
    cursor: pointer;
    border-radius: 0.2rem;
    transition: background-color 0.5s, border-color 0.5s ease-in-out;
    background-color: var(--button-filter);
    margin: 0 0.5rem;
    border: 2px solid transparent;
}

.blue-segment {
    color: var(--blue);
}

.purple-segment {
    color: var(--purple);
}

/* Hover effect for each segment with unique border color */
.blue-segment:hover { border-color: var(--light-blue); }
.all-segment:hover { border-color: var(--alle-button); }
.purple-segment:hover { border-color: var(--light-purple); }

/* Active state for segments */
.blue-segment.active {
    background-color: #4691BF;
    color: white;
    border-color: #4691BF;
}

.all-segment.active {
    background-color: #b2b2b2;
    color: white;
    border-color: #b2b2b2;
}

.purple-segment.active {
    background-color: #895B8B;
    color: white;
    border-color: #895B8B;
}

/* Refresh container and icon */
/* ==========================================================
   PAGINATION NAVIGATION STYLES
   ========================================================== */
.refresh-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 0.8rem;
    margin-bottom: 0.5rem;
}

.refresh-container .item-counter {
    color: var(--text);
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    min-width: 2rem; 
}

.pagination-arrow {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text);
    transition: color 0.3s, transform 0.2s ease-in-out;
}

.pagination-arrow:hover {
    transform: scale(1.2);
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .pagination-arrow {
        color: var(--counter);
    }

    .pagination-arrow:hover {
        color: var(--light-blue);
    }
}

/* ==========================================================
   CONTAINER & GRID LAYOUT
   ========================================================== */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--item-min-width), 1fr));
    grid-gap: 0.7rem;
    justify-content: center;
    max-width: 100vw;
    margin: auto;
    padding: 0.5rem;
    box-sizing: border-box;
}

/* Responsive grid layout */
@media (min-width: 1200px) {
    .container {
        max-width: 900px;
        grid-template-columns: repeat(4, minmax(var(--item-min-width), 1fr));
    }
}
@media (max-width: 1200px) and (min-width: 900px) {
    .container {
        max-width: 75vw;
        grid-template-columns: repeat(3, minmax(var(--item-min-width), 1fr));
    }
}
@media (max-width: 900px) and (min-width: 550px) {
    .container {
        max-width: 80vw;
        grid-template-columns: repeat(2, minmax(var(--item-min-width), 1fr));
    }
}
@media (max-width: 550px) {
    .container {
        max-width: 100%;
        grid-template-columns: 1fr;
    }
    .item {
        width: 100%;
        max-width: 100%;
    }
}

/* ==========================================================
   ITEM STYLES
   ========================================================== */
.item {
    background-color: var(--items);
    border-radius: 0.2rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 15rem;
    text-align: center;
    align-items: center;
    min-width: var(--item-min-width);
    height: auto;
    cursor: pointer;
    border: 0.07rem solid transparent;
    margin: auto;
    opacity: 0;
    transition: opacity 0s ease-in;
}

.item.visible {
    opacity: 1;
}

@media (max-width: 550px) {
    .item {
       min-height: 8rem;
       max-width: 75vw;
    }
}

.item:hover {
    transform: translateY(-0.2rem);
}

h3 {
    font-size: 1rem;
    margin: 0;
    flex-grow: 1;
    line-height: 1.3rem;
    color: var(--text);
}

.author {
    color: var(--author);
    font-size: 0.9rem;
    margin-top: 1.2rem;
}

.location-full { display: inline; }
.location-short { display: none; }

@media (max-width: 768px) {
    .location-full { display: none; }
    .location-short { display: inline; }
}

.item img {
    max-width: 1.875rem;
    margin-bottom: 1rem;
}

.blue { border-color: var(--light-blue); }
.purple { border-color: var(--light-purple); }

/* ==========================================================
   POPUP STYLES
   ========================================================== */
.popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-container.show {
    display: flex;
}

.popup-item {
    background-color: var(--items);
    padding: 1.25rem;
    border-radius: 0.3rem;
    min-height: 19rem;
    width: 80%;
    max-width: 25rem;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin: 0 auto;
}

.popup-item img {
    display: block;
    margin: 0 auto 1.5rem;
    max-width: 3rem;
}

.blue-popup { border: 0.2rem solid var(--light-blue); }
.purple-popup { border: 0.2rem solid var(--light-purple); }

.popup-text {
    font-size: 1.125rem;
    color: var(--text);
    margin: 0 1rem 2rem;
    flex-grow: 1;
    text-align: left;
    line-height: 2rem;
}

.popup-author {
    color: var(--author);
    font-size: 1rem;
    margin-top: auto;
    margin-bottom: 1em;
}

.btn-close-popup {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    cursor: pointer;
    padding: 1rem; /* Increase the clickable area */
    margin: -1rem 0; /* Adjust margins to keep visual position */
}

.purple-popup .btn-close-popup:hover { color: var(--purple); }
.blue-popup .btn-close-popup:hover { color: var(--blue); }

/* Popup navigation */
.arrow {
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.6rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10%;
    z-index: 10;
}

.left-arrow { left: -1.25rem; }
.right-arrow { right: -1.25rem; }

.item-counter {
    color: var(--counter);
    font-size: 1rem;
    text-align: center;
    margin-top: auto;
    line-height: 1.2;
}