/* Variables CSS */
:root {
    --primary-color: #2c5530;
    --secondary-color: #4a7c59;
    --accent-color: #8fb996;
    --light-color: #f8f9fa;
    --card-bg: #e8f5e8;
    --dark-color: #343a40;
    --text-color: #333;
    --text-light: #6c757d;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 8px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.2;
    color: var(--text-color);
    background-color: #fff;
    padding-top: 50px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: white;
    position: relative;
}

/* Línea 1: Logo pequeño + CARMINA + Filtros + Menú - SIEMPRE FIJA */
.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    gap: 1rem;
    background: white;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    box-shadow: var(--shadow);
    padding-left: 20px;
    padding-right: 20px;
}

/* Logo pequeño + texto CARMINA */
.logo-small {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-small-img {
    height: 32px;
    width: auto;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e5a99;
    letter-spacing: 1px;
    font-family: 'Arial Black', 'Arial Bold', sans-serif;
    text-transform: uppercase;
}

.logo {
    display: flex;
    align-items: center;
}

/* Filtros Desktop */
.filters-desktop {
    display: flex;
    align-items: center;
}

.filter-select {
    padding: 8px 12px;
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius);
    background: white;
    color: var(--primary-color);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 180px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Navigation Desktop */
.nav {
    display: flex;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s;
    font-size: 1rem;
}

.nav-links a:hover {
    background: #3d6b47;
    color: white;
}

/* Iconos móvil */
.mobile-icons {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.filter-toggle.mobile {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Línea 2: Logo + Título - Se oculta naturalmente con scroll */
.page-title {
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    background: white;
    margin-top: -50px;
    padding-top: calc(50px + 1.5rem);
}

.page-title .logo {
    display: inline-block;
    vertical-align: middle;
    margin-right: 1.5rem;
}

.page-title .logo-img {
    height: 120px;
    width: auto;
    vertical-align: middle;
}

.page-title h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin: 0 0 0.5rem 0;
    line-height: 1.1;
    display: inline-block;
    vertical-align: middle;
}

.page-description {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.2;
    margin: 0;
    margin-top: 0.5rem;
}

/* Filtros Móvil - Panel desplegable */
.filters-mobile {
    display: none;
}

.mobile-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    font-size: 0.9rem;
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Products Page */
.products-page {
    padding: 2rem 0;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* Loading Message */
.loading-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    font-size: 1.2rem;
}

.loading-message i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
    color: var(--primary-color);
}

.product-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: fit-content;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.product-image {
    height: 150px;
    overflow: visible;
    background-color: #ffffff;
    margin: 5px;
    position: relative;
    border-radius: 4px;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s;
    border: 3px solid #e0e0e0;
    border-radius: 4px;
    box-sizing: border-box;
    background-color: transparent;
}

.product-card:hover .product-image img {
    transform: scale(1.02);
}

.product-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-info h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
    font-size: 1.1rem;
    line-height: 1.2;
}

.product-description {
    color: var(--text-light);
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Price */
.price-detailed {
    margin: 0.5rem 0;
}

.price-option {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.2;
}

.price-label {
    font-weight: 500;
}

.price-amount {
    font-weight: bold;
    color: var(--primary-color);
}

/* Features */
.features-list {
    margin: 0.5rem 0;
}

.features-list h4 {
    margin-bottom: 0.3rem;
    color: var(--dark-color);
    font-size: 0.9rem;
    line-height: 1.2;
}

.features-list ul {
    list-style: none;
    padding-left: 0;
}

.features-list li {
    padding: 0.1rem 0;
    position: relative;
    padding-left: 1.2rem;
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.2;
}

.features-list li:before {
    content: "✓";
    color: var(--success-color);
    position: absolute;
    left: 0;
    font-weight: bold;
    font-size: 0.8rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.product-actions {
    margin-top: auto;
    padding-top: 0.8rem;
}

/* Footer - Reducido */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 1.5rem 0 0;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 0 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 0.5rem;
    color: var(--accent-color);
    line-height: 1.2;
    font-size: 1.1rem;
}

.footer-section p {
    margin-bottom: 0.3rem;
    opacity: 0.8;
    line-height: 1.2;
    font-size: 0.9rem;
}

.footer-bottom {
    text-align: center;
    padding: 1rem;
    margin-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-main {
        padding: 0.5rem 0;
    }

    .logo-small-img {
        height: 28px;
    }

    .brand-name {
        font-size: 0.95rem;
    }

    .page-title .logo {
        display: block;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .page-title .logo-img {
        height: 70px;
    }

    .page-title h1 {
        font-size: 1.5rem;
        display: block;
    }

    .page-description {
        font-size: 0.9rem;
    }

    .filters-desktop {
        display: none;
    }

    .nav {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        max-height: 100vh;
        overflow-y: auto;
        z-index: 1001;
        flex-direction: column;
    }

    .nav.active {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        gap: 0;
        text-align: center;
        padding-top: 3rem;
        width: 100%;
    }

    .nav-links li {
        border-bottom: 1px solid var(--border-color);
        width: 100%;
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a {
        display: block;
        padding: 1.2rem 1rem;
        font-size: 1.1rem;
        color: var(--text-color);
        text-decoration: none;
        transition: all 0.3s;
        width: 100%;
    }

    .nav-links a:hover {
        background: #3d6b47 !important;
        color: white !important;
    }

    .mobile-icons {
        display: flex;
    }

    .filters-mobile {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        max-height: 100vh;
        overflow-y: auto;
        z-index: 1001;
        padding-top: 3rem;
    }

    .filters-mobile.active {
        display: block;
    }

    .mobile-filters {
        flex-direction: column;
        gap: 0;
        padding: 0 1rem;
        padding-top: 3rem;
    }

    .mobile-filters .filter-btn {
        padding: 1.2rem 1rem;
        border: none;
        border-bottom: 1px solid var(--border-color);
        background: transparent;
        color: var(--text-color);
        cursor: pointer;
        transition: all 0.3s;
        font-weight: 500;
        font-size: 1.1rem;
        text-align: left;
        width: 100%;
        border-radius: 0;
    }

    .mobile-filters .filter-btn:last-child {
        border-bottom: none;
    }

    .mobile-filters .filter-btn.active {
        background: var(--primary-color);
        color: white;
    }

    .mobile-filters .filter-btn:not(.active):hover {
        background: #3d6b47;
        color: white;
    }

    .mobile-filters .filter-btn.active:hover {
        background: #3d6b47;
        color: white;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .container {
        padding: 0 15px;
    }

    .products-page {
        padding: 1rem 0;
    }

    /* Botón de cerrar para paneles móviles */
    .panel-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-color);
        cursor: pointer;
        z-index: 1002;
        padding: 0.5rem;
    }

    .panel-close:hover {
        color: var(--primary-color);
    }

    /* Scrollbar personalizada para los paneles */
    .nav::-webkit-scrollbar,
    .filters-mobile::-webkit-scrollbar {
        width: 6px;
    }

    .nav::-webkit-scrollbar-track,
    .filters-mobile::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .nav::-webkit-scrollbar-thumb,
    .filters-mobile::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 3px;
    }

    .nav::-webkit-scrollbar-thumb:hover,
    .filters-mobile::-webkit-scrollbar-thumb:hover {
        background: var(--secondary-color);
    }
}

@media (max-width: 480px) {
    .product-image {
        height: 130px;
    }

    .product-info {
        padding: 0.8rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1rem;
    }

    .page-title h1 {
        font-size: 1.3rem;
    }

    .footer {
        padding: 1.5rem 0 0;
    }

    .nav-links a,
    .mobile-filters .filter-btn {
        padding: 1rem;
        font-size: 1rem;
    }
}