/**
 * @project      HTML Pixabay Search
 * @description  A simple web application for displaying ranked users from Pixabay.
 *               This script is a JavaScript implementation for fetching and displaying 
 *               media from the Pixabay API.
 * @author       XTML (Boxo Plug)
 * @version      1.0.0
 * @date         2024-09-25
 */

body {
    font-family: "Montserrat", sans-serif;
    margin: 0;
    background-color: #151517;
    letter-spacing: 0.10068em;
    color: #c7c9d1;
}

b {
    color: #ffffff;
}

#header {
    background-color: #1e1e20;
    max-width: 100%;
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #2a2a2f;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 99999999999999;
}

a.alpxbapi {
    color: #5164ff;
    font-weight: 600;
}

a {
    color: #ffffffdb;
    cursor: pointer;
    text-decoration: none;
}

li.li-nav-no {
    position: relative;
    top: 13px;
    font-size: 0.98em;
    font-weight: 500;
    float: left;
    padding: 0 15px;
    list-style: none;
    color: white;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #2a2a2f;
}

::-webkit-scrollbar-thumb {
    background: #3b3b44;
}

::-webkit-scrollbar-thumb:hover {
    background: #34343a;
}

#xtml-html-pixabay-search-bar {
    margin: 71px 0 0 0;
    background-color: #222223;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999999;
    padding: 10px 15px;
    max-width: 100%;
}

#xtml-html-pixabay-search-gallery {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 4.5em;
    padding: 20px;
    margin-top: 145px;
}

.xtml-html-pixabay-search-image-container {
    margin: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    width: calc(25% - 20px);
    position: relative;
    height: 0;
    padding-bottom: 25%;
}

.xtml-html-pixabay-search-image-container img,
.xtml-html-pixabay-search-image-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.xtml-html-pixabay-search-image-details {
    padding: 10px;
    text-align: center;
    font-size: 14px;
    background-color: #f4f4f4;
    margin: 0;
}

.xtml-html-pixabay-search-image-container a {
    display: block;
    text-align: center;
    padding: 10px;
    text-decoration: none;
    color: white;
    background-color: #28a745;
    border-radius: 4px;
    margin: 10px;
}

#xtml-html-pixabay-search-next-button {
    display: block;
    margin: 5px;
    padding: 10px;
    width: 100%;
    max-width: 150px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    float: right;
    right: 21px;
    position: fixed;
}

#xtml-html-pixabay-search-next-button:hover {
    background-color: #0056b3;
}

#xtml-html-pixabay-search-page-info {
    text-align: center;
    margin: 20px;
}

h1 {
    font-size: 1.5em;
    margin-block-start: 4em;
    margin-block-end: -44px;
    margin-inline-start: 20px;
    margin-inline-end: 0px;
    font-weight: 600;
    color: white;
}

#xtml-html-pixabay-search-page-search-section {
    width: 100%;
    float: left;
    background-color: #222223;
    max-width: 320px;
}

#xtml-html-pixabay-search-page-bntsearch-section {
    width: fit-content;
    float: left;
    padding-left: 15px;
}

#xtml-html-pixabay-search-page-info-section {
    width: 100%;
    max-width: 100%;
    background-color: #1e1e20;
    position: fixed;
    z-index: 999999999;
    bottom: 0;
    height: 70px;
    border-top: 1px solid #2a2a2e;
    display: flex;
}

#xtml-html-pixabay-search-page-info {
    width: 50%;
    float: left;
    align-content: end;
    display: flex;
    cursor: all-scroll;
}

/* Search Bar Styling */
#xtml-html-pixabay-search-bar input,
#xtml-html-pixabay-search-bar select,
#xtml-html-pixabay-search-bar button {
    margin: 5px;
    padding: 10px 10px 10px 15px;
    width: 100%;
    max-width: 100%;
    background-color: #121213;
    border: 0px;
    font-weight: 400;
    color: #fffffff7;
    letter-spacing: 0.68px;
    font-size: 1em;
    border: 1px solid #2a2a2f;
    border-radius: 0px;
    overflow: hidden !important;
    background: rgb(24, 24, 26);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    font-family: "Montserrat", sans-serif;
    cursor: pointer;
}

button {
    margin-left: 43px;
}

button {
    background-color: #3036ff !important;
    border: 0px;
    background: linear-gradient(90deg, #7e53fe 0%, #3036ff 50%) !important;
    border-radius: 6px !important;
    color: #ffffff !important;
    font-family: "Montserrat", sans-serif;
    cursor: pointer;
}

a.download-link {
    background-color: #2a2a2f;
    max-width: 100%;
    width: 100%;
    display: inline-block;
    text-align: center;
    line-height: 3em;
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    font-size: 1em;
}

a.download-link:hover {
    background-color: #3036fe;
    background: linear-gradient(90deg, #7e53fe 0%, #3036ff 50%) !important;
    transition: 0.25s;
}

/* Gallery Styling */
.image-container {
    position: relative;
    overflow: hidden;
    border: 1px solid #2a2a2f;
    border-radius: 5px;
    background-color: #1e1e20;
}

.caption-item {
    max-width: 100%;
    height: 36px;
    overflow: hidden;
    margin-bottom: 5px;
}

.image-container img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s;
}

.image-container:hover img {
    transform: scale(1.05);
}

.image-details {
    padding: 20px 20px 10px 20px;
    text-align: left;
}

/* Page Info Section */
#xtml-html-pixabay-search-page-info-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

img.img-logo {
    width: 88px;
    padding-left: 20px;
    padding-top: 8px;
}

/* Style for the select element */
#xtml-html-pixabay-search-media-type {
    background-color: #2c2c2c;
    color: #ffffff;
    border: 1px solid #444444;
    border-radius: 5px;
    padding: 10px;
    font-size: 16px;
    appearance: none;
    width: 100%;
    cursor: pointer;
}

#xtml-html-pixabay-search-media-type::after {
    content: '▼';
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
}

#xtml-html-pixabay-search-media-type:focus {
    outline: none;
    border-color: #007bff00;
    box-shadow: 0 0 5px rgb(0 123 255 / 0%);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: none;
}

input:hover,
textarea:hover,
select:hover {
    background-color: inherit;
    border-color: inherit;
    cursor: auto;
}

img.icn-user {
    width: 20px !important;
    height: 20px;
    background-color: #38383f;
    float: left;
    padding: 5px 7px;
    border-radius: 10px;
    margin-right: 10px;
}




span.span-item {
    line-height: 30px;
    font-weight: 600;
    font-size: 0.8em;
    cursor: all-scroll;
}

.image-container {
    position: relative;
    display: inline-block;
    margin: 10px;
    height: fit-content;
}

.image-container img {
    width: 100%;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
}

#image-zoom-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    max-width: 80%;
    max-height: 80%;
    border: 2px solid #333;
    background-color: rgba(0, 0, 0, 0.8);
}

#image-zoom-popup img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 5px;
}

#image-zoom-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #151516;
    z-index: 999999999999999999999;
    opacity: 1;
    transition: opacity 1s ease;
}

#xtml-html-pixabay-search-menu {
    width: fit-content;
    right: 0;
    position: absolute;
    top: 13px;
}

#openModalBtn {
    display: block;
    max-width: 400px;
    border: 0px;
    font-weight: 600;
    letter-spacing: 0.68px;
    font-size: 15px;
    border-radius: 0px;
    overflow: hidden !important;
    background: rgb(21 21 22);
    background: linear-gradient(90deg, rgb(25 25 26) 0%, rgb(66 66 189 / 0%) 50%);
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    font-family: "Montserrat", sans-serif;
    margin: 2px auto;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: fit-content;
    float: right;
    right: 21px;
    position: fixed;
    background: linear-gradient(90deg, #7e53fe00 0%, #3036ff00 50%) !important;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0, 0, 0);
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #151516;
    margin: 0;
    width: 100%;
    height: 100vh;
    left: 0;
    top: 0;
    position: fixed;
}

.close {
    color: #eaeaed;
    float: right;
    font-size: 42px;
    font-weight: 400;
    position: relative;
    left: -12px;
}


.close:hover,
.close:focus {
    text-decoration: none;
    cursor: pointer;
}

ul {
    list-style-type: none;
    padding: 0;
    margin-block-start: 5px;
    margin-block-end: 5px;
    padding-inline-start: 0;
}

.user-list-item {
    display: flex;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid #2a2a2f;
    margin-bottom: 0;
}

.user-list-item img {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    margin-right: 15px;
    position: absolute;
    right: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-details a {
    text-decoration: none;
    color: #ffffff;
    font-weight: bold;
    margin-bottom: -5px;
}

.user-details p {
    margin: 0;
    color: #a4a7b5;
    font-size: 14px;
    padding-top: 2px;
}

.user-rank {
    margin-right: 15px;
    font-weight: 700;
    color: #ffffff;
    background-color: #3036ff;
    border-radius: 10px;
    position: relative;
    font-size: 1em;
    padding: 5px;
    line-height: 38px;
    width: 36px;
    text-align: center;
    height: 36px;
    background: linear-gradient(90deg, #7e53fe 0%, #3036ff 50%) !important;
}

ul.ul-nav {
    margin-block-start: -5px;
}

li {
    line-height: 1.68em;
    list-style: disc;
    margin-left: 20px;
    margin-bottom: 1.2em;
}

.container {
    display: flex;
    flex-wrap: wrap;
    margin: 60px auto 0;
    max-width: 100%;
    padding: 0 10px;
}

.section {
    flex: 1 1 100%;
    padding: 30px;
    border: 1px solid #2a2a2f;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    background-color: #1e1e20 !important;
    max-width: 100%;
    width: 100%;
    float: right;
    line-height: 1.6em;
    cursor: pointer;
    height: fit-content;
    margin-bottom: 10px;
}

.section:hover {
    transform: scale(1.02);
}

h2 {
    display: block;
    font-size: 1.5em;
    margin-block-start: -5px;
    margin-block-end: 0;
    margin-inline-start: 0;
    margin-inline-end: 0;
    font-weight: bold;
    unicode-bidi: isolate;
}

h2.section-title {
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1.5em;
    margin-bottom: 30px;
    color: #ffffff;
}

#userList {
    margin-top: 4.5em;
}

img.screen {
    max-width: 100%;
    border: 1px solid #2a2a2f;
    margin-bottom: 1.5em;
}

b.bcode {
    color: #5164ff;
}

@media (max-width: 1200px) {
    #xtml-html-pixabay-search-gallery {
        grid-template-columns: repeat(4, 1fr);
    }

    .xtml-html-pixabay-search-image-container {
        width: calc(33.33% - 20px);
        padding-bottom: 33.33%;
    }
}

@media (max-width: 1080px) {
    #xtml-html-pixabay-search-page-search-section {
        width: 28%;
    }
}

@media (max-width: 800px) {
    #xtml-html-pixabay-search-page-search-section {
        width: 25%;
    }
}

@media (max-width: 992px) {
    #xtml-html-pixabay-search-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .xtml-html-pixabay-search-image-container {
        width: calc(50% - 20px);
        padding-bottom: 50%;
    }
}

@media (max-width: 768px) {
    #xtml-html-pixabay-search-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    #xtml-html-pixabay-search-page-search-section {
        width: 47%;
    }

    #xtml-html-pixabay-search-gallery {
        margin-top: 195px;
    }

    #xtml-html-pixabay-search-page-bntsearch-section {
        width: 44%;
    }
}

@media (max-width: 600px) {
    .xtml-html-pixabay-search-image-container {
        width: 100%;
        padding-bottom: 100%;
    }

    #xtml-html-pixabay-search-media-type {
        font-size: 14px;
        padding: 8px;
    }
}

@media (max-width: 576px) {
    #xtml-html-pixabay-search-gallery {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    #xtml-html-pixabay-search-page-search-section {
        width: 100%;
        max-width: 90%;
        overflow: hidden;
    }

    #xtml-html-pixabay-search-page-bntsearch-section {
        width: 89%;
        padding-left: 0;
    }

    #xtml-html-pixabay-search-gallery {
        margin-top: 295px;
    }
}
