html,body{
    scroll-behavior: smooth;
    scrollbar-color: auto !important;
}
*{
    margin: 0;padding: 0;
    box-sizing: border-box;
    font-family: 'Times New Roman';
}
body{
    background: linear-gradient(90deg, #903fe6, #2666d4);
    color: white;
    overflow-y: overlay;
}
h1 {
    text-align: center;
    margin: 50px auto;
    font-weight: 700;
    font-size: 48px;
    background-color: #f1f0f0;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}
form{
    width: 40%;
    min-width: 250px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    box-shadow: none;
    gap: 0;
}
form input{
    flex: 1;
    height: 100%;
    border: 0;
    outline: 0;
    background-color: white;
    color: black;
    font-size: 18px;
    padding: 0 30px;
    border-radius: 8px;
    margin-right: 6px;
}
form button{
    padding: 0 40px;
    height: 3rem;
    background: red;
    color: white;
    font-size: 16px;
    border: 0;
    outline: 0;
    border-radius: 10px;
    cursor: pointer;
}
::placeholder{
    color: black;
    font-size: 18px;
}
#more-btn{
    background: red;
    color: white;
    border: 0;
    outline: 0;
    font-size: 20px;
    padding: 14px 16px;
    border-radius: 5px;
    margin: 10px auto 100px;
    cursor: pointer;
    display: none; 
    transition: transform 0.2s;
}
#more-btn:active{
    transform: scale(0.96);
    background-color:red;
}
#search-result{
    width: 85%;
    margin: 100px auto 50px;
    display: grid;
    grid-template-columns: auto auto auto;
    grid-gap: 30px;
}
#search-result img{
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 10px;
    border: 3px solid white;
    transition: 0.3s;
}
#search-result img:hover{
    transform:scale(1.05);
}
#traverse-back{
    display: none;
    border-radius: 50%;
    float: right;
    background-color: red;
    padding: 10px 14px;
    border: 0;
    outline: 0;
    color: white;
    font-size: 24px;
    margin-right: 40px;
    margin-bottom: 65px;
}

#traverse-back:hover{
    transform: scale(1.1);
    background-color:red ;
}
#traverse-back i {
    font-size: 22px; /* Icon size */
    color: white; /* Icon color */
}
#footer{
    display: flex;
    align-items: center;
    justify-content: center;
}
::-webkit-scrollbar {
    width: 20px;
}
::-webkit-scrollbar-track{
    background-color:#2666d4;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb {
    background: #98a0a8;
    border-radius: 30px;
    border: 5px solid transparent;
    background-clip: padding-box;
}

.search-input-container {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 3rem;
}

#search-box {
    padding-left: 3em; /* space for the icon */
    width: 100%;
    box-sizing: border-box;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6f00ff;
    pointer-events: none;
    font-size: 1.3em;
}

@media (max-width: 768px) {
    h1 {
        font-size: 36px; /* Smaller font for heading */
        margin: 30px auto;
    }

    form {
        width: 90%; /* Wider form on tablets */
        min-width: unset; /* Remove min-width constraint */
        flex-direction: column; /* Stack input and button */
        height: auto; /* Auto height to accommodate stacked elements */
        gap: 15px; /* Space between stacked input and button */
    }

    form input {
        width: 90%; /* Full width for input */
        padding: 12px 20px;
        font-size: 16px;
        margin-right: 0; /* Remove right margin when stacked */
    }

    form button {
        width: 20%; /* Full width for button */
        padding: 12px 20px;
        font-size: 16px;
    }

    ::placeholder {
        font-size: 16px;
    }

    #search-result {
        width: 95%; /* Wider search results area */
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* 2 columns or more if space allows */
        grid-gap: 20px;
        margin: 50px auto 30px;
    }

    #search-result img {
        height: 250px; /* Slightly smaller image height */
    }

    #more-btn {
        font-size: 18px;
        padding: 12px 14px;
        margin: 10px auto 50px; /* Adjust margin */
    }

    #traverse-back {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 20px;
        margin-right: 0; /* Remove fixed margin */
        margin-bottom: 0; /* Remove fixed margin */
    }

    #traverse-back i {
        font-size: 18px;
    }

    #footer {
        margin-top: 30px;
        gap: 15px;
    }
    ::-webkit-scrollbar {
        width: 18px;
    }
    ::-webkit-scrollbar-track{
        background-color:#2666d4;
        background-clip: padding-box;
    }
    ::-webkit-scrollbar-thumb {
        background: #98a0a8;
        border-radius: 30px;
        border: 5px solid transparent;
        background-clip: padding-box;
    }
}

/* Smaller phones (up to 480px wide) */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 28px;
        margin: 20px auto;
    }

    form {
        width: 95%; /* Even wider form on small phones */
        padding: 0 10px;
        gap: 10px;
    }

    form input,
    form button {
        font-size: 14px;
        padding: 10px 15px;
    }

    ::placeholder {
        font-size: 14px;
    }

    #search-result {
        width: 100%; /* Full width for results */
        grid-template-columns: 1fr; /* Single column layout */
        grid-gap: 15px;
        margin: 30px auto 20px;
        padding: 0 10px;
    }

    #search-result img {
        height: 200px; /* Smaller image height for single column */
    }

    #more-btn {
        font-size: 16px;
        padding: 10px 12px;
        margin: 10px auto 30px;
    }

    #traverse-back {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    #traverse-back i {
        font-size: 16px;
    }

    #footer {
        margin-top: 20px;
        gap: 10px;
    }
    ::-webkit-scrollbar {
        width: 16px;
    }
    ::-webkit-scrollbar-track{
        background-color:#2666d4;
        background-clip: padding-box;
    }
    ::-webkit-scrollbar-thumb {
        background: #98a0a8;
        border-radius: 30px;
        border: 5px solid transparent;
        background-clip: padding-box;
    }
}
