/* Header Styles - FarmaciaDG */

.top-bar {
    background-color: var(--brand-dark);
    color: white;
    padding: 8px 0;
    font-size: 0.85rem;
}

.main-header {
    background-color: var(--brand-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.search-bar {
    display: flex;
    flex: 1;
    max-width: 500px;
    margin: 0 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 5px 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.search-bar input {
    border: none;
    background: transparent;
    flex: 1;
    outline: none;
    padding: 8px;
    color: white;
    font-size: 16px;
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

.search-bar button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.1rem;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-cart-btn {
    position: relative;
    cursor: pointer;
    font-size: 1.4rem;
    color: white;
    padding: 8px;
    transition: transform 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-cart-btn:hover {
    color: var(--brand-green);
    transform: scale(1.1);
}

.header-cart-btn .cart-count-badge {
    position: absolute;
    top: 0;
    right: -2px;
    background: #ff4757;
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--brand-blue);
    padding: 2px;
}

.nav-links a {
    margin-left: 20px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    transition: color 0.3s;
}

.nav-links a:hover {
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.nav-links .btn-primary {
    color: white;
    background: linear-gradient(135deg, var(--brand-green), #43a047);
    border: none;
    box-shadow: 0 3px 10px rgba(97, 206, 112, 0.4);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-links .btn-primary:hover {
    background: linear-gradient(135deg, #43a047, #2e7d32);
    box-shadow: 0 5px 15px rgba(97, 206, 112, 0.5);
    transform: translateY(-1px);
    color: white;
    text-shadow: none;
}

/* Responsive Header */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .main-header .container {
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
    }

    .main-header {
        position: relative;
        padding: 10px 0;
    }

    /* Logo y Carrito arriba y centrados */
    .logo-group {
        flex: 0 0 100%;
        justify-content: center;
        margin-bottom: 15px;
    }

    .logo {
        text-align: center;
    }

    .logo img {
        margin: 0;
    }

    /* Menu hamburguesa a la izquierda abajo */
    .mobile-menu-btn {
        display: block;
        padding: 8px 12px;
        order: 2;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
    }

    /* Buscador a la derecha abajo */
    .search-bar {
        order: 3;
        flex: 1;
        margin: 0;
        max-width: none;
        background: rgba(255, 255, 255, 0.15);
        font-size: 16px;
    }

    .search-bar input {
        font-size: 16px !important;
    }

    .header-actions {
        order: 2;
        gap: 10px;
    }

    .header-cart-btn {
        font-size: 1.2rem;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: var(--brand-blue);
        padding: 0 20px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        border-top: 1px solid rgba(255, 255, 255, 0.1);

        /* Transición suave para evitar sensación de "cuelgue" */
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-10px);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none;
    }

    .nav-links.active {
        max-height: 500px; /* Ajustar según contenido real */
        padding: 20px;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-links a {
        margin: 10px 0;
        font-size: 1.1rem;
        width: 100%;
        text-align: center;
    }

    .top-bar {
        font-size: 0.72rem;
        padding: 5px 0;
    }

    .top-bar .container {
        justify-content: center;
        gap: 15px;
        flex-wrap: nowrap;
        /* Forzar una sola línea */
    }

    .top-bar .socials {
        white-space: nowrap;
        /* Evitar que el texto interno salte de línea */
    }

    .hide-mobile {
        display: none !important;
    }
}