/* css/style_catalogo.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensures footer sticks to bottom */
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

/* Header */
header {
    background-color: #f8f8f8;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #eee;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin: 0 auto;
    max-width: 1200px;
    width: 90%;
    background-color: transparent;
    box-shadow: none;
}

.logo {
    color: #333;
    margin: 0;
    font-size: 28px;
    font-weight: 700;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for responsiveness */
    justify-content: center;
}

nav ul li {
    margin-left: 25px;
}

nav ul li a {
    text-decoration: none;
    color: #555;
    font-weight: 600;
    transition: color 0.3s ease;
    padding: 5px 0;
    display: block;
}

nav ul li a:hover {
    color: #007bff;
}

/* Cart Icon in Navbar */
.cart-icon {
    position: relative;
    margin-left: 25px;
}
.cart-icon a {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #007bff; /* Highlight cart icon */
}
.cart-icon a .fas {
    font-size: 1.2em;
}
.cart-icon #cart-count {
    background-color: #dc3545; /* Red badge */
    color: white;
    border-radius: 50%;
    padding: 2px 7px;
    font-size: 0.8em;
    position: relative;
    top: -8px; /* Adjust position */
    right: 5px;
}


h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.2em;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    display: inline-block;
    width: auto;
    margin-left: auto;
    margin-right: auto;
}

/* Messages (Success/Error) */
.message-container {
    margin-bottom: 20px;
}
.message-container p {
    padding: 12px 20px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    margin: 0; /* Remove default paragraph margin */
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Search and Filter Section */
.search-filter-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.search-bar {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping */
    gap: 10px;
    align-items: center;
}

.search-input, .filter-select {
    flex: 1; /* Allow inputs to grow */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
    min-width: 150px; /* Minimum width for inputs/selects */
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
}

.btn-primary {
    background-color: #007bff;
    color: #fff;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.btn-search {
    background-color: #28a745; /* Green for search */
}
.btn-search:hover {
    background-color: #218838;
}

.btn-clear-filter {
    background-color: #ffc107; /* Orange for clear filter */
    color: #333;
}
.btn-clear-filter:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-2px);
}


/* Product Grid */
.product-grid {
    margin-top: 30px;
}

.products-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Responsive grid */
    gap: 25px;
}

.product-card {
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 15px; /* Space for button */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

.product-card.agotado {
    opacity: 0.7;
    border: 2px dashed #dc3545;
}
.product-card.expired {
    opacity: 0.7;
    border: 2px dashed #ffc107;
}

.product-image {
    width: 100%;
    height: 200px; /* Fixed height for consistent cards */
    object-fit: cover; /* Cover the area, crop if necessary */
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}

.product-card h3 {
    font-size: 1.4em;
    color: #333;
    margin: 10px 15px;
    min-height: 40px; /* Ensure consistent height for titles */
}

.product-card .price {
    font-size: 1.5em;
    color: #007bff;
    font-weight: bold;
    margin: 5px 15px 10px;
}

.product-card .description {
    font-size: 0.9em;
    color: #666;
    margin: 0 15px 10px;
    min-height: 60px; /* Consistent height for description snippet */
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card .stock {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 10px;
}

.product-card .status-message {
    font-weight: bold;
    margin-bottom: 10px;
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
    font-size: 0.9em;
}

.product-card .out-of-stock {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.product-card .expired-product {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
}


.add-to-cart-btn {
    background-color: #28a745;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.3s ease;
    width: calc(100% - 30px); /* Full width minus padding */
    margin: 0 15px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-to-cart-btn:hover:not(:disabled) {
    background-color: #218838;
}

.add-to-cart-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.8;
}

.no-products {
    font-size: 1.2em;
    color: #666;
    text-align: center;
    margin-top: 50px;
    padding: 30px;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #eee;
}

/* Footer */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: auto;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

footer .container {
    padding: 0 20px;
    margin: 0 auto;
    background-color: transparent;
    box-shadow: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        text-align: center;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
        margin-top: 15px;
    }

    nav ul li {
        margin: 8px 0;
        margin-left: 0; /* Remove horizontal margin for vertical stack */
    }
    .cart-icon {
        margin-left: 0;
        margin-top: 10px;
    }
    .cart-icon #cart-count {
        position: static; /* Reset position for smaller screens */
        top: auto;
        right: auto;
        margin-left: 5px;
    }

    .catalog-header h2 {
        font-size: 1.8em;
    }

    .search-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
    }

    .search-input, .filter-select, .btn {
        width: 100%; /* Full width for form elements */
        min-width: unset; /* Reset min-width */
    }

    .products-container {
        grid-template-columns: 1fr; /* Single column on small screens */
    }
    .product-card {
        max-width: 350px; /* Limit card width on very small screens */
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
        margin: 10px auto;
    }
    .logo {
        font-size: 24px;
    }
    .add-to-cart-btn {
        font-size: 0.9em;
        padding: 10px 15px;
    }
}