/* Make body a column flex container */
html, body {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
}

/* Header top section with logo and menu button */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

/* Make header items spaced */
header {
    background-color: #28cc5f;
    color: white;
    padding: 1vh 2vw;
    flex-wrap: wrap;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: auto;
    gap: 1vh;
}

/* Logo size */
.logo {
    height: 8vh;
    max-height: 80px;
    width: auto;
}

/* Recipe image size */
.recipe-image {
    height: 300px;
    max-height: 40vh;
    width: 100%;
    object-fit: cover;
}

/* Recipe card image size (smaller than recipe page) */
.recipe-card-image {
    height: 120px;
    width: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

/* Recipe flag image styling */
.recipe-flag {
    height: 20px;
    width: auto;
    margin-top: 5px;
    border-radius: 2px;
    object-fit: contain;
}

/* Recipe card layout - responsive */
.recipe-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    background-image: url('/recetas/assets/images/logo_tarjeta.jfif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/* Parrilla recipe cards use different background */
.recipe-card.parrilla {
    background-image: url('/recetas/assets/images/logo_parrilla.png');
}

.recipe-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.75);
    border-radius: 8px;
    z-index: 1;
}

.recipe-card > * {
    position: relative;
    z-index: 2;
}

.recipe-card-content {
    flex: 1;
    min-width: 0;
}

/* Navigation links */
#main-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Desktop navigation layout */
@media (min-width: 769px) {
    header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        min-height: 80px;
        gap: 0;
    }
    
    .header-top {
        width: auto;
    }
    
    .search-container {
        width: auto;
        flex: 1;
        justify-content: center;
        margin: 0;
    }
    
    #main-nav {
        width: auto;
        flex-direction: row;
    }
}

header nav a {
    color: white;
    margin: 0 2vw;
    text-decoration: none;
    font-weight: bold;
    font-size: 1rem;
}

header nav a:hover {
    text-decoration: underline;
}

/* Search bar styling */
.search-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.search-container input[type="text"] {
    padding: 1vh 1vw;
    font-size: 0.9rem;
    border-radius: 3px;
    border: none;
    width: 200px;
    min-width: 150px;
}

.search-container button {
    padding: 1vh 1.5vw;
    font-size: 0.9rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    background-color: #000000;
    color: white;
    white-space: nowrap;
}

.search-container button:hover {
    background-color: #777;
}

/* Dropdown button */
.dropbtn {
    background-color: #000000;
    color: white;
    padding: 1vh 1.5vw;
    font-size: 0.9rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
}

.dropbtn:hover {
    background-color: #777;
}

/* Dropdown container */
.dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Dropdown content */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    max-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1001;
    left: 0;
    border-radius: 4px;
    overflow: hidden;
}

/* Links inside the dropdown */
.dropdown-content a {
    color: black;
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
}

/* Change color of dropdown links on hover */
.dropdown-content a:hover {
    background-color: #f1f1f1;
}

/* Show the dropdown menu on hover (desktop only) */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-content {
        display: block;
    }
    
    .dropdown-content {
        position: absolute !important;
        left: 0 !important;
        top: 100% !important;
        transform: none !important;
    }
}

/* Show dropdown on click for mobile */
@media (max-width: 768px) {
    .dropdown-content.show {
        display: block;
    }
}

/* Popup styling */
#filter-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    color: black;
    padding: 3vh 3vw;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 1000;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

#filter-popup button {
    background-color: #000000;
    color: white;
    margin-top: 2vh;
}

/* Main content area */
main {
    flex: 1;
    overflow-y: auto;
    padding: 2vh 2vw;
    box-sizing: border-box;
}

/* Recipe grid - responsive */
.recipe-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    width: 90%;
    max-width: 600px;
    margin: 0 auto;
}

/* Procedure content width limitation */
.procedure {
    max-width: 70vw;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Footer */
footer {
    background-color: #28cc5f;
    color: white;
    text-align: center;
    padding: 1.5vh 0;
    width: 100%;
    font-size: 0.9rem;
}

/* Responsive design for mobile devices */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    #main-nav {
        display: none;
        flex-direction: column;
        align-items: center;
        gap: 1vh;
        padding: 1vh 0;
        background-color: rgba(0, 0, 0, 0.1);
        border-radius: 8px;
    }
    
    #main-nav.mobile-open {
        display: flex;
    }
    
    .header-top {
        margin-bottom: 1vh;
    }
    
    .logo {
        height: 6vh;
        max-height: 50px;
    }
    
    .search-container {
        width: 100%;
        justify-content: center;
        margin-bottom: 1vh;
        flex-wrap: wrap;
        gap: 1vh;
    }
    
    .search-container input[type="text"] {
        width: 70%;
        max-width: 250px;
        order: 1;
    }
    
    .search-container button:not(.dropbtn) {
        width: 70%;
        max-width: 250px;
        order: 2;
    }
    
    .dropdown {
        order: 3;
        width: 70%;
        max-width: 250px;
        display: flex;
        justify-content: center;
        margin-top: 0.5vh;
    }
    
    .dropbtn {
        width: 100%;
        text-align: center;
    }
    
    .dropdown-content {
        right: 50%;
        transform: translateX(50%);
        min-width: 140px;
    }
    
    header nav a {
        margin: 0.5vh 1vw;
        font-size: 0.9rem;
    }
    
    .recipe-card {
        flex-direction: column;
        gap: 2vh;
        text-align: center;
    }
    
    .recipe-card-image {
        height: 25vh;
        max-height: 180px;
    }
    
    .recipe-grid {
        width: 95%;
    }
    
    main {
        padding: 1vh 1vw;
    }
}

@media (max-width: 480px) {
    .search-container {
        flex-direction: column;
        gap: 1vh;
        align-items: center;
    }
    
    .search-container input[type="text"] {
        width: 90%;
        max-width: 280px;
        order: 1;
    }
    
    .search-container button:not(.dropbtn) {
        width: 90%;
        max-width: 280px;
        order: 2;
    }
    
    .dropdown {
        order: 3;
        width: 90%;
        max-width: 280px;
    }
    
    .dropdown-content {
        left: 0;
        right: 0;
        transform: none;
        min-width: auto;
    }
    
    #main-nav.mobile-open {
        padding: 2vh 0;
    }
    
    header nav a {
        font-size: 0.8rem;
        margin: 1vh 1vw;
        padding: 0.5vh 1vw;
    }
    
    .recipe-card-image {
        height: 20vh;
        max-height: 150px;
    }
    
    .logo {
        height: 5vh;
        max-height: 40px;
    }
}
