* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Lato", sans-serif;
}

body {
    background-color: #f8f8ff;
}

header {
    display: flex;
    justify-content: center;
    position: relative;
}

.logo {
    width: 200px;
    padding: 1rem;
}

.title-image-container {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.hero {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.details-container {
    width: 400px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    /* border: 1px solid white; */
}

.hero-heading {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-paragraph {
    font-size: 1rem;
}

.search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-block: 1rem;
    width: 100%;
    /* border: 1px solid black; */
}

.search-container input {
    width: 50%;
    padding: 1rem;
    border: 2px solid #d6d6d6;
    border-right: none;
    border-radius: 0.5rem 0 0 0.5rem;
}

.search {
    background-color: #f1c22b;
    font-size: 1.5rem;
    padding: 0.72rem;
    border-radius: 0 0.5rem 0.5rem 0;
    cursor: pointer;
    border: none;
}

form i {
    transition: all 0.3s ease-in-out;
}

form i:hover {
    transform: rotate(-0.13turn);
}

/* Loader Section */
.loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.75s, visibility 0.75s;
}

.loader-hidden {
    opacity: 0;
    visibility: hidden;
}

.loader::after {
    content: "";
    width: 30px;
    height: 30px;
    border: 10px solid #dddddd;
    border-top-color: #f1c22b;
    border-radius: 50%;
    transform: translate(50%, 50%);
    animation: loading 0.75s ease infinite;
}

@keyframes loading {
    from {
        transform: rotate(0turn);
    }

    to {
        transform: rotate(1turn);
    }
}

/* --- Main Content --- */
.container {
    max-width: 1440px;
    margin: 40px auto;
    padding: 0 15px;
}

.title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 35px;
    color: #333;
}

#recipe-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
}

.error {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
}

/* --- Card UI --- */
.card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    transition: 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-body h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.card-body p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
}

.view-btn {
    background: #ffc107;
    color: white;
    border: none;
    padding: 10px 18px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    align-self: flex-end;
    margin-top: auto;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 15px;
}

.modal-content {
    background-color: white;
    width: 100%;
    max-width: 650px;
    height: auto;
    max-height: 85vh;
    border-radius: 15px;
    position: relative;
    overflow-y: auto;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.1);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.close-icon {
    position: absolute;
    top: 12px;
    right: 15px;
    font-size: 30px;
    cursor: pointer;
    color: white;
    z-index: 10;
    text-shadow: 0 0 5px #000;
}

.close-btn-modal {
    background: #ffc107;
    color: white;
    border: none;
    padding: 10px 18px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    align-self: flex-end;
    margin-top: auto;
    margin-bottom: 1rem;
    position: relative;
    left: 85%;
}

.modal-img {
    width: 100%;
    height: 320px;
    object-fit: cover;
    border-bottom: 5px solid #ffc107;
}

.modal-info {
    padding: 25px;
}

/* --- Footer Section --- */
footer {
    background-color: #fff;
    color: #000000;
    padding: 1rem;
    text-align: center;
    margin-top: 50px;
    font-size: 1rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

footer a {
    font-size: 1rem;
    margin-right: 1rem;
}

footer i {
    transition: all 0.2s ease-in-out;
}

footer i:hover {
    transform: scale(1.5);
}

/* --- Back To Top Icon --- */
.iconbutton {
    position: fixed;
    bottom: 40px;
    right: 40px;
    display: none;
    z-index: 999;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

.iconbutton.show {
    display: block;
    opacity: 1;
    transform: scale(1);
}

.iconbutton.hide {
    opacity: 0;
    transform: scale(0.8);
}

.iconbutton a {
    background-color: #ffc107;
    font-size: 1.5rem;
    border-radius: 50%;
    padding: 0.5rem;
}


/* --- Responsive Designs --- */
@media (max-width: 1200px) {
    #recipe-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    #recipe-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-paragraph {
        font-size: 1rem;
    }
}

@media (max-width: 668px) {
    .search-container input {
        width: 80%;
    }
}

@media (max-width: 576px) {
    #recipe-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    footer {
        flex-direction: column;
    }
}

@media (max-width: 432px) {
    .details-container {
        width: 300px;
    }

    .hero-heading {
        font-size: 2rem;
    }

    .hero-paragraph {
        font-size: 1rem;
    }
}