/* ==========================================================================
   CSS Variables & Reset
   ========================================================================== */
:root {
    --primary-color: #0b132b;
    /* Dark Navy for header/footer */
    --secondary-color: #172a45;
    /* Slightly lighter navy */
    --accent-color: #1a365d;
    /* Button colors */
    --background-light: #f4f7f9;
    /* Main page background */
    --text-color: #333333;
    --text-light: #ffffff;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --placeholder-bg: #e2e8f0;
    --placeholder-icon: #94a3b8;
    --chat-btn-bg: #2563eb;

    --font-main: 'Inter', sans-serif;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--background-light);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.main-header {
    position: fixed;
    /* Make header sticky */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 0;
    background: transparent;
    transition: background-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
}

.main-header.scrolled {
    background-color: var(--primary-color);
    padding: 10px 0;
    top: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-container-fluid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 40px;
    width: 100%;
}

/* Empty space handled by grid layout */

.logo {
    opacity: 0;
    /* Hidden when at top */
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    text-align: center;
}

.main-header.scrolled .logo {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-logo-img {
    height: 48px;
    width: auto;
    display: block;
    margin: 0 auto;
    /* Keep it centered */
}

.main-nav {
    justify-self: end;
    /* Align items to the right side of grid cell */
}

.main-nav ul {
    display: flex;
    gap: 24px;
    align-items: center;
}

.main-nav a {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: capitalize;
    transition: opacity var(--transition-speed) ease;
}

.main-nav a:hover {
    opacity: 0.8;
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    padding-bottom: 20px;
    /* Bridge the hover gap */
    margin-bottom: -20px;
}

.dropdown>a {
    position: relative;
    padding-bottom: 5px;
}

/* Hover underline like in screenshot */
.dropdown>a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-light);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-speed) ease;
}

.dropdown:hover>a::after {
    transform: scaleX(1);
    opacity: 1;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #040814;
    /* Very dark background to match screenshot */
    min-width: 250px;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-speed) ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    display: block;
    width: 100%;
}

.dropdown-menu a {
    color: #e2e8f0;
    padding: 12px 25px;
    display: block;
    text-transform: none;
    /* Sentence case as in screenshot */
    font-size: 0.9rem;
    font-weight: 400;
    /* Regular weight */
}

.dropdown-menu a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    opacity: 1;
}

.lang-selector img {
    border-radius: 2px;
    vertical-align: middle;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
    position: relative;
    height: 350px;
    background: url('../img/BANNER-NOSOTROS-PROEPSA.png') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 60px;
    /* Offset for absolute header */
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.hero-title {
    position: relative;
    z-index: 1;
    color: var(--text-light);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Main Content & Search
   ========================================================================== */
.main-content {
    flex: 1;
    padding: 40px 0 80px;
}

.search-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 40px;
}

.search-box {
    display: flex;
    width: 300px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.search-box input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-right: none;
    padding: 10px 15px;
    font-size: 0.9rem;
    outline: none;
    color: var(--text-color);
    font-family: inherit;
}

.search-box button {
    background-color: var(--primary-color);
    color: var(--text-light);
    border: none;
    padding: 0 15px;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.search-box button:hover {
    background-color: var(--accent-color);
}

/* ==========================================================================
   Product Grid
   ========================================================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    text-align: left;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02), 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05), 0 4px 6px rgba(0, 0, 0, 0.03);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.product-linea {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--chat-btn-bg);
    background-color: rgba(37, 99, 235, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.product-brand {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    background-color: #f1f5f9;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.product-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-sku {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
    word-break: break-word;
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-desc {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 20px;
    line-height: 1.4;
    flex: 1;
}

.product-footer {
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.product-stock {
    font-size: 0.85rem;
    font-weight: 600;
    color: #059669;
    background-color: #d1fae5;
    padding: 6px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.main-footer {
    background-color: #070e26;
    color: var(--text-light);
    padding: 50px 0 20px;
    margin-top: auto;
}

.footer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.footer-logo-row {
    display: flex;
    justify-content: center;
    width: 100%;
}

.footer-cities-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 15px;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 15px;
}

.footer-logo-img {
    height: 50px;
    width: auto;
    display: block;
}

.location {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.footer-bottom {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.copyright {
    font-size: 0.75rem;
    opacity: 0.5;
    font-weight: 400;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.page-btn {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-speed);
}

.page-btn:hover {
    background-color: var(--border-color);
}

.page-btn.active {
    background-color: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .header-container {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .footer-locations {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .footer-bottom {
        justify-content: center;
        text-align: center;
    }
}